What is the output of the following C code? int main () { int x = 5; printf("%dn", x++); return 0;

What is the output of the following C code? int main () { int x = 5; printf("%dn", x++); return 0;

Explanation
  • The printf("%dn", x++); prints the value of x before incrementing it.
  • Since x++ is a post-increment operator, the value of x (5) is printed first, and then x becomes 6 after the statement.