可能重複:
What is the correct answer for cout << c++ << c;?爲了在C++打印的
我有下面的代碼 -
int a= 7;
const int &b = a;
int &c = a;
如果我使用
cout << endl << ++c << '\t' << a << '\t' << b << '\t' << c;
它打印
"8 7 7 8"
但是如果我用
cout << endl << a << '\t' << b << '\t' << ++c << '\t' << a << '\t' << b << '\t' << c;
它打印
"8 8 8 8 8 8"
究竟是如何發生這種情況?這與優化有關嗎?如果是的話,我怎麼能在ideone.com中關閉它?
還有,當你說'的cout << ++ C語言的<<ç會發生什麼重複的地方;'。雖然我不確定在哪裏。 – chris
http://stackoverflow.com/questions/10782863/what-is-the-correct-answer-for-cout-c-c – nneonneo
@nneonneo,那是一個,謝謝。 – chris