Which of the following gives the nth element of the Array?
Options
- A. array[n];
- B. array[n-1];
- C. array[n+1];
- D. More than one of the above
- E. None of the above
Quiz Practice:
B. array[n-1];
Answer: (B) array[n-1];
C++ arrays use zero-based indexing. This means the first element is at index 0.
Therefore:
1st element → array[0]
2nd element → array[1]
3rd element → array[2]
So, the nth element is located at index n-1.
Hence, the correct expression is array[n-1].