How do you declare an array of integers containing 5 elements?
20242024
How do you declare an array of integers containing 5 elements?
- A.
int array[5];
- B.
int array;
- C.
array int[5];
- D.
int array();
Attempted by 1022 students.
Show answer & explanation
Correct answer: A
In C, an array declaration includes the data type, followed by the array name and its size enclosed within square brackets. In this case, int array[5]; declares an integer array of 5 elements. The elements are uninitialized and will contain garbage values.