A

Admin • 833K Points
Coach

Q. What is the value of 'a' after this code?

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

Explanation by: Admin

a++ returns the value before incrementing, and assignment overwrites the change.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.