G

Gopal Sharma • 38.32K 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: 45
  • Filed under category C++

Explanation by: Gopal Sharma
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.


Question analytics