Multiple choice

void main() { int realarray[2]={1,2}; int *array = &realarray[-1]; int i; for(i=0;i<2;i++) { printf(" %d",*array); array++; } }

  1. Error

  2. Garbage Value 1

  3. 0 1

  4. 1 2

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The line int *array = &realarray[-1] uses negative array indexing, which is undefined behavior. However, it typically works by pointing before the array start. When the loop runs, *array accesses realarray[-1](garbage/previous memory), then array++ makes it point to realarray[0]=1. So output is garbage value followed by 1.