C++ question about arrays to access the arrays elements

  arrays, c++

the queston that i have is about arrays in c++.
Give
int z[5]={1,2,3,4,5};
cout<<-2[z];
The output is -3 (The second element of the array). I didnot understand the principle of accessing the array using this method as what I know is that if i want to access the 2nd element of the array i would use z[2] and the multiply buly -1 to to get -3. My question is what is the theory behind using -2[z] instead of z[2]*-1 and how are they equivalent.
Thankyou

Source: Windows Questions C++

LEAVE A COMMENT