Here's the program.
#include <iostream>
int main (int argc, char * argv[]) {
int a[4] = {10, 11, 18, 32};
int x = 2[a];
int y = a[2];
std::cout << "x = " << x << '\n';
std::cout << "y = " << y << '\n';
return 0;
}
The output is as follows.
x = 18
y = 18
How is "2[a]" legal syntax? What is happening in this program to make this work? Even https://cdecl.org/ says 2[a] is a syntax error.