@Catfish4:
In that context 2 is not a pointer, neither has a pointer type assigned to it.
I assume it doesn't work, but I also assume you wanted to show the op it doesn't work straightaway.
@zero117:
To make
2[pi]
work, it will become:
((int *)(2))[pi]
The reason why it works is:
Let's examinate this code snip:
1 2 3

int Data[] = { 0, 1, 2, 3, 4 };
int * pi = Data;
cout << pi[2];

What is written is "2".
It's the third element in the array.
Its location, in your RAM, is:
(pi + 2)
So, to access it you can do
pi[2]
.
But also
*(pi+2)
.
Due to mathematical rules, you will also be able to do
*(2+pi)
And
((int *)(2))[pi]
is equivalent to
*(2+pi)