A

Admin • 833K Points
Coach

Q. What will be the output of the following code?

Code:
#include <stdio.h>
int main() {
int a = 5;
printf("%d", a++);
return 0;
}
  • (A) 5
  • (B) 6
  • (C) Compiler Error
  • (D) Garbage Value
  • Correct Answer - Option(A)
  • Views: 22
  • Filed under category C Programming
  • Hashtags:

Explanation by: Admin

Post-increment returns the original value before incrementing, so 'a++' prints 5.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.