find the output of the following program
main()
{
int x=5, *p;
p=&x;
printf("%d",++*p);
}

Answers were Sorted based on User's Feedback



find the output of the following program main() { int x=5, *p; p=&x; prin..

Answer / guest

6

Is This Answer Correct ?    103 Yes 4 No

find the output of the following program main() { int x=5, *p; p=&x; prin..

Answer / rahul khare

6
becoz it(++*p) will evaluate like this-
1)
*(p)- gives value at this address that is 5
2)
now increment ++5
that is 6.

Is This Answer Correct ?    37 Yes 1 No

find the output of the following program main() { int x=5, *p; p=&x; prin..

Answer / lrishna

ya ans is 6.

Is This Answer Correct ?    32 Yes 7 No

find the output of the following program main() { int x=5, *p; p=&x; prin..

Answer / vignesh1988i

the answer is 6...since ++ as well as * gets the same
prority so the associativity will be right to left.. so it
will point to the value and then increment the value

Is This Answer Correct ?    23 Yes 3 No

find the output of the following program main() { int x=5, *p; p=&x; prin..

Answer / rajeesh

Six -6

Is This Answer Correct ?    15 Yes 3 No

find the output of the following program main() { int x=5, *p; p=&x; prin..

Answer / visalakshi

yes it is six

Is This Answer Correct ?    11 Yes 0 No

find the output of the following program main() { int x=5, *p; p=&x; prin..

Answer / manishsoni

main()
{
int x=5, *p;
p=&x;
printf("%d",++*p);
}
it allocate as this

____ _____
x| |value p | | store &x
| 5 | | 100 |
|____| |_____|
____ _____
|100 |&x | 200 |&p p is pointer //at statement ++*p
|____| |_____|
^ ^
|________________|
and jumpt at 5 bcoz it is prefix for firstof all 5 is
increase then print

Is This Answer Correct ?    7 Yes 2 No

find the output of the following program main() { int x=5, *p; p=&x; prin..

Answer / ganesh auti,pune

6

Is This Answer Correct ?    6 Yes 2 No

find the output of the following program main() { int x=5, *p; p=&x; prin..

Answer / nava

TO MY KNOWLDGE
6 IS THE ANSWER

Is This Answer Correct ?    3 Yes 0 No

find the output of the following program main() { int x=5, *p; p=&x; prin..

Answer / dilip

6

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More C Interview Questions

How can I find the day of the week given the date?

0 Answers  


do u print this format '(((())))'. This brackets is based on user input like 4 or 5 or 6,without using any loop's?

1 Answers   Oracle,


#include<stdio.h> int f(int,int); int main() { printf("%d",f(20,1)); return 0; } int f(int n,int k) { if(n==0) return 0; else if(n%2)return f(n/2,2*k)+k; else return f(n/2,2*k)-k; } how this program is working and generating output as 9....?

1 Answers  


CAN ANYONE PLEASE HELP ON THIS PROGRAM FOR MY EXAM..TQ Write a C program to help a H’s Restaurant automate its breakfast billing system. Your assignment should implement the following items: a. Show the customer the different breakfast items offered by the H’s Restaurant. b. Allow the customer to select more than one item from the menu. c. Calculate and print the bill to the customer. d. Produce a report to present your complete program and show more sample output. Assume that the H’s Restaurant offers the following breakfast menu: Plain Egg $2.50 Bacon and Egg $3.45 Muffin $2.20 French Toast $2.95 Fruit Basket $3.45 Cereal $0.70 Coffee $1.50 Tea $1.80 Your program must do the following task below: a. Define the data structs, menu item types with two components: menu item of type string and menu price of type double. Use an array to declare the data structs. b. Function get data to loads the data into the array menu list. c. Function show menu to show the different breakfast items offered by the restaurant and tell the user how to select the items. d. Function print receipt to calculates and prints the customer receipt. The billing amount should include a 5% tax. e. Format your output with two decimal places. The name of each item in the output must be left-justify. You may assume that the user selects only one item of a particular type. f. The two sample output as shown: Welcome to HiFi’s Restaurant 1 Bacon and Egg $3.45 1 Muffin $2.20 1 Coffee $1.50 Tax 5% $0.35 Amount Due $7.50

1 Answers  


What is function definition in c?

0 Answers  






diff .between strcture and union

2 Answers  


find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2

0 Answers   TCS,


What is the right way to use errno?

0 Answers  


please explain every phase in the "SDLC" in the dotnet.

0 Answers  


Is c an object oriented programming language?

1 Answers  


WHO WROTE C LANGUAGE?

4 Answers  


Are global variables static in c?

0 Answers  


Categories