?
What will be printed after execution of the following code?
What will be printed after execution of the following code?
void main()
{
int arr[10] = {1,2,3,4,5};
printf("%d", arr[5]);
}
void main()
{
int arr[10] = {1,2,3,4,5};
printf("%d", arr[5]);
}
Answer & Solution
Correct Answer:
Option
D
When an array is partially initialized at the time of declaration then the remaining elements of the array is initialized to 0 by default.
Join the Discussion
Login to post a comment or share your explanation.
Loginvoid main()
{
int a[5]={2,4,8};
printf(“%d”,a[5]);
}