Discussion :: Arrays
-
What will be the output of the following code?
void main()
{
int a[10];
printf("%d %d", a[-1], a[12]);
}
A.
0 0 |
B.
Garbage value 0 |
C.
0 Garbage Value |
D.
Garbage vlaue Garbage Value |
E.
Code will not compile |
Answer : Option D
Explanation :
In c compiler does not check array with its bounds, value at the computed location is displayed.
Be The First To Comment