Why is this example of code behaving differently in c++ and C#.
[C++ Example]
int arr[2]; int index = 0; arr[index]
Your C++ code could, in fact, do anything. arr[index] = ++index; invokes undefined behaviour.
arr[index] = ++index;