ExamVeda
Login
Home
This question belongs to C Program Arrays And Strings
Arrays and Strings
?

What will be the output of the following code?
void main()
{
      int a[10];
      printf("%d %d", a[-1], a[12]);
}

Answer & Solution
Correct Answer: Option D

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

Examveda
Question posted by Examveda
Community

Join the Discussion

6 Comments
Amrutha P
Amrutha P 6 years ago
answer should be garbage value and 0
Daniyal Ansari
Daniyal Ansari 6 years ago
0 12063648 answer that is why c is the write answer..
Addanki Siva
Addanki Siva 7 years ago
is negative indexing allowed in c
Abbas Ahmad
Abbas Ahmad 8 years ago
The output will be [ 0 Garbage Value ]
Oma Choudhary
Oma Choudhary 9 years ago
A range check is a check to make sure a number is within a certain range; for example, to ensure that a value about to be assigned to a 16-bit integer is within the capacity of a 16-bit integer (i.e. checking against wrap-around).
Oma Choudhary
Oma Choudhary 9 years ago
output is 0 0 not any garbage value