Which of the following correctly declares an array?
2008
Which of the following correctly declares an array?
- A.
int geeks[20];
- B.
int geeks;
- C.
geeks{20};
- D.
array geeks[20];
Attempted by 1531 students.
Show answer & explanation
Correct answer: A
The correct syntax to declare an array in C/C++ involves specifying the data type, followed by the variable name and the size enclosed in square brackets. For instance, int geeks[20]; is valid. Other options may declare single variables or use incorrect syntax.
A video solution is available for this question — log in and enroll to watch it.