166k views
3 votes
What will the following code display?

int numbers[] = {99, 87, 66, 55, 101 };
cout << numbers[3] << endl;

A) 55
B) 66
C) 101
D) 87

User Wuffwuff
by
8.0k points

1 Answer

7 votes

Final answer:

The C++ code displays the fourth element of the array 'numbers', which is 55, because arrays in C++ are zero-indexed.

Step-by-step explanation:

The code snippet provided is written in C++ and is accessing an element of an array. The array numbers is defined with the following elements: {99, 87, 66, 55, 101}. When the cout statement is executed, it will print the element at index 3 of the array. In C++, array indexing starts at 0, so index 3 corresponds to the fourth element of the array, which in this case is 55. Therefore, the correct answer is A) 55.

User GoldenaArcher
by
8.7k points