Vidyalelo
C Programming · Q41

Arrays and Strings

Programming · C Programming · question 41

Q41

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
Answer
E.
Code will not compile

Answer: Option D

Solution

Answer: Option D
Solution:

In c compiler does not check array with its bounds, value at the computed location is displayed.