Arrays
- Which of the following is the correct output for the program given below?
#include
int main()
{
int arr[5] = {12, 23);
printf("%d%d%d\n", a[2], a[3], a[4]);
return 0;
}
-
View Hint View Answer Discuss in Forum
When an automatic array is partially initialized, the remaining array elements are initialized to 0.
Correct Option: D
When an automatic array is partially initialized, the remaining array elements are initialized to 0.
So the the initialization in the question will be equivalent to
int arr[5] = {12, 23, 0, 0, 0);