Which of the following is a valid declaration of an integer array in C++?
Options
- A. int marks[10];
- B. array int marks[10];
- C. int[10] marks;
- D. More than one of the above
- E. None of the above
Quiz Practice:
A. int marks[10];
Answer: (A) int marks[10];
The standard syntax for declaring an array in C++ is:
data_type array_name[size];
Therefore, int marks[10]; is a valid declaration.
It declares an array named marks whose elements are of type int.
The array declaration itself does not use the word array.