A

Admin • 833K Points
Coach

Q. What is the output of the following code snippet? int arr[3] = {1, 2, 3}; cout << arr[3];

  • (A) 1
  • (B) 2
  • (C) 3
  • (D) Undefined behavior
  • Correct Answer - Option(D)
  • Views: 18
  • Filed under category C++
  • Hashtags:

Explanation by: Admin

Accessing arr[3] is out of bounds and results in undefined behavior.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.