A

Admin • 802.91K Points
Coach

Q. What is the output of the following code snippet? int x = 5; int y = x++; cout << y;

  • (A) 5
  • (B) 6
  • (C) 0
  • (D) Error
  • Correct Answer - Option(A)
  • Views: 4
  • Filed under category C++
  • Hashtags:

Explanation by: Admin
The post-increment operator (x++) assigns the original value of x to y before incrementing x.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.