A

Admin • 833K Points
Coach

Q. What will the following code print?

Code:
int a = 5;
printf("%d %d", a++, ++a);
  • (A) 5 6
  • (B) 6 6
  • (C) Undefined behavior
  • (D) 6 7
  • Correct Answer - Option(C)
  • Views: 19
  • Filed under category C Programming
  • Hashtags:

Explanation by: Admin

Modifying a variable more than once in the same statement causes undefined behavior.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.