Multiple choice

Which one of the following is a valid method for accessing the 3rd element of the array cust?

  1. cust.3

  2. cust[3]

  3. cust[2]

  4. cust(2)

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

C++ arrays are zero-indexed. Therefore, the first element is at index 0, the second at index 1, and the third element is at index 2.