Assume the code is inside main and stdio.h is included. What does this program print?
int a = 5;
int b = a++;
printf("%d %d", a, b);- (A)
5 5
- (B)
6 5
- (C)
6 6
- (D)
5 6
Answer and solution
Answer: (B)
a++ gives the old value of a first.
So b gets 5.
After that, a becomes 6.
The program prints 6 5, option B.