A

Admin • 833K Points
Coach

Q. What is the output of the following code?

int x = 10;
cout << ++x * x++;

  • (A) 110
  • (B) 121
  • (C) 120
  • (D) Undefined behavior
  • Correct Answer - Option(D)
  • Views: 22
  • Filed under category C++
  • Hashtags:

Explanation by: Admin

The expression causes undefined behavior due to modifying 'x' multiple times without an intervening sequence point.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.