Vidyalelo
C Programming · Q43

Operators and Expressions

Programming · C Programming · question 43

Q43

What is the output of the following statements? int i = 0; printf("%d %d", i, i++);

A.
0 1
B.
1 0
Answer
C.
0 0
D.
1 1
E.
None of these

Answer: Option B

Solution

Answer: Option B
Solution:
Since the evaluation is from right to left.
So when the print statement execute value of i = 0
Since its execute from right to left when i++ will be execute first and print value 0 (since its post increment ) and after printing 0 value of i become 1.
So it its prints for 1 for next i.