Hello everyone:
Recently we were given this example:
int array[10]={0,1,2,3,4,5,6,7,8,9};
Of course if you printf("%d", array[2]); the output would be 2.
But our tutor raised such a confusing debate:
in math x + 2 = 2 + x.
and we knew array is but a pointer to int.
therefore array[2] means the location of the address of array plus two memory unit for int.
Thus
array[2] = array +2 = 2 + array = 2[array]
Given this formula, we were astonished to see the output of
printf("%d", 2[array]) is identical to the previous one.
We accepted this but at least for me, I really don't know why...