0
可能重複:
Could anyone explain these undefined behaviors (i = i++ + ++i , i = i++, etc…)爲什麼這段代碼輸出3
我發現這段代碼,原來在這裏:
#include <stdio.h>
int main()
{
int p = 0;
p = p++ + ++p;
printf("p=%d\n", p);
}
我猜輸出將是2 ,但是當我編譯代碼並執行它時,輸出爲3,爲什麼?
http://stackoverflow.com/questions/949433/could-anyone-explain-these-undefined-behaviors-iiiii-etc – Mysticial 2012-04-03 01:38:45
只是要確定:您是否在尋找對此輸出的解釋未定義的行爲? – cctan 2012-04-03 01:42:07
閱讀由編譯器生成的彙編代碼。 – 2012-04-03 01:44:10