Vidyalelo
C Programming · Q38

Function

Programming · C Programming · question 38

Q38

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

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

Answer: Option D

Solution

Answer: Option D
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
Function mcq solution image