During a Quiz,we were supposed to find the output of the following code:
#include<stdio.h>
int main()
{
int a[3] = {10,12,14};
int i = 0;
while(i<3)
{
printf("%d\n ",i[a]);
i++;
}
return 0;
}
The Output of this Code is:
10 12 14
I have read through various books and websites but still i do not get how this code is working. I assumed the code will have a compilation error since i is not an array but somehow in this case it prints the above mentioned output. I experimented by passing pointers instead of the array and it still worked. It would be very kind of you to explain since my lecturer won't reply.