A

Admin • 833K Points
Coach

Q. What will be the output of the following code?

int a = 5;
cout << ++a;

  • (A) 5
  • (B) 6
  • (C) Error
  • (D) None of the above
  • Correct Answer - Option(B)
  • Views: 9
  • Filed under category C++
  • Hashtags:

Explanation by: Admin

The '++a' is a pre-increment operator, which increments the value of 'a' before it is used, so the output is 6.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.