#include <stdio.h>
main()
{
int a[5] = {5,1,15,20,25};
int i,j,m;
i = ++a[1];
j = a[1]++;
m = a[i++];
printf("%d %d %d\n",i,j,m);
}
Okay now the program compiles and runs fine. But the output which i get is 3 2 15 i.e i =3 , j=2, m = 15. I don't understand how come the value of i becomes 3 as a[1] i.e '1' when incremented must become 2. This is a 'trace the output' type of question. I'm using gcc.