Partial Array Initialization in C: Remaining Elements Me Kya Value Aata Hai?
C
Easy
5 views
Problem Description
When initializing an array, if I write `int arr[5] = {10, 20, 30}`, what values will be stored in the remaining two elements, and how does the compiler handle this?
Official Solution
#include <stdio.h>
int main() {
int arr[5] = {10, 20, 30};
int i;
printf("Array elements are:n");
for (i = 0; i < 5; i++) {
printf("arr[%d] = %dn", i, arr[i]);
}
return 0;
}
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!