I have the following code in C++:
#include <iostream>
using namespace std;
int main()
{
int a[2][4] = {3, 6, 9, 12 , 15, 18, 21, 24};
cout << *(a[1]+2) << *(*(a+1)+2) << 2[1[a]];
return 0;
}
Now when I run the code, it outputs a[1][2] which is 21 three times, meaning that the three expressions in the cout statement all refer to a[1][2], but I don't understand how the three expressions work although I know basically what an address and a pointer is, the third expression seems clearer than the first two, it is similar to a[1][2] in shape but looks like it's flipped inside out. Can someone explain how these expressions work? and if there's a reference or a list of the ways of indexing an array please mention it also.