What is the output of the below program?
void main()
{
int student[] = {};
printf("%d", sizeof(student));
}
---------------------------------------------------------
The above code tests the following:
1. Array declaration
2. Array initialization
3. Array default size
---------------------------------------------------------
An array is an user defined data type which allocates contiguous memory to the elements in it.
In the above code an array student[] is just declared and nothing assigned.
In this scenario, the array is not assigned any size, so, '0' shall be the size of the array.
0 Comments