// Example illustrating ambig code, "i = a[i++];" // compile with g++, output is 3 // compile with CC, output is 36 // compile with Visual C++, output is 37 // The ambiguity is based on when the increment operation occurs, // before or after the assignment operation, and whether a // reqister value or memory located is incremented. #include using namespace std; int main() { int a[5], i; a[0] = 12; a[1] = 24; a[2] = 36; a[3] = 48; a[4] = 60; i = 2; i = a[i++]; cout << i << endl; return 0; }