Thursday, 21 August 2014

What is the output of the Following Program?



#include<stdio.h>
#include<conio.h>
void main( )
{
            int a[5] = {1,2};
            printf("%d,%d,%d",a[1],a[2],a[3]);
}

Options:
A)1,2,3
B)2,0,0
C)Garbage Values
D)2,1,1



Answer Option B)
When an automatic array is partially initialised, the remaining array elements are initialised to 0(zero).





0 comments:

Post a Comment