Hi!
I was doing my exercise of C Language. In the exercise I was encountered by a question in which author says you to perdict the correct answer; I was uable to perdict it, so I compiled it to get the answer, the source code is this:
#include <stdio.h>
int main ()
{
struct {
int x, y;
}s[] = {10, 20, 15, 25, 8, 75, 6, 2};
int *i;
i = s;
printf("%d", s[i[7]].x);
return 0;
}
It yields this output:
8
I'm unable to understand why the answer is 8 whereas in my thinking it should be 15.
Please help me.....!!!!!