Vidyalelo
C Programming · Q12

C Miscellaneous

Programming · C Programming · question 12

Q12

Determine Output: void main() int i=5; printf("%d%d%d%d%d", i++, i--, ++i, --i, i);

A.
45545
Answer
B.
54544
C.
55445
D.
54554

Answer: Option A

Solution

Answer: Option A
Solution:
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 below
C Miscellaneous mcq solution image