Determine Output:
void main()
{
int i=5;
printf("%d%d%d%d%d", i++, i--, ++i, --i, i);
}
void main()
{
int i=5;
printf("%d%d%d%d%d", i++, i--, ++i, --i, i);
}
A. 45545
B. 54544
C. 55445
D. 54554
Answer: Option A
Solution(By Examveda Team)
The arguments in a function call are pushed into the stack from left to right. The evaluation is by popping out from the stack. and the evaluation is from right to left, hence the result. See the picture belowJoin The Discussion
Comments ( 6 )
Related Questions on C Miscellaneous
Determine output:
void main()
{
int const *p=5;
printf("%d", ++(*p));
}
A. 6
B. 5
C. Garbage Value
D. Compiler Error
A. mmm nnn aaa
B. mmmm nnnn aaaa
C. Compiler Error
D. None of These
A. I hate Examveda
B. I love Examveda
C. Error
D. None of These
Determine Output:
void main()
{
static int var = 5;
printf("%d ", var--);
if(var)
main();
}
A. 5 5 5 5 5
B. 5 4 3 2 1
C. Infinite Loop
D. None of These
I am getting 45555. link: https://ideone.com/MXJt1K
we are compile this question but answer is change and not given in options
the answer we get 55555
You are not using stack ,i am getting 45555 answer please respond
Ok the stack fact
exactly how a could be the answer
how option A is the answer?