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
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 |
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 |
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 |
1 What is a Data Structure?
What is the meaning of this decleration? unsigned char (*pArray[10][10]); please reply.
What is the purpose of the preprocessor directive error?
a construct the"else" part of "if" statement contains anoth "if else" statement is called a) if-else b) else-if-else c) if-else-if-else d) chain if/if-else-if
In a byte, what is the maximum decimal number that you can accommodate?
main() { int i=5; printf("%d%d%d%d",i++,i--,i); }
Hi Every one...........I have been selected for the SBI Clerk. But i m one month Pregnanat. So anyone please suggest me, is they take any objection on my joining .
4 Answers State Bank Of India SBI,
How important is structure in life?
Every time i run a c-code in editor, getting some runtime error and editor is disposing, even after reinstalling the software what may be the problem?
a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler
How can you find the exact size of a data type in c?
wat is the output #define VOLEDEMORT _who_must_not_be_named int main() { printf("VOLEDEMORT"); }