Possible Duplicate:
What is the correct answer for cout << c++ << c;?
I have following code -
int a= 7;
const int &b = a;
int &c = a;
if I use
cout << endl << ++c << '\t' << a << '\t' << b << '\t' << c;
it prints
"8 7 7 8"
however if I use
cout << endl << a << '\t' << b << '\t' << ++c << '\t' << a << '\t' << b << '\t' << c;
it prints
"8 8 8 8 8 8"
How exactly this happens ? Is it something related to optimization ?? If yes, how can i switch it off in ideone.com ???