【发布时间】:2011-06-10 00:51:08
【问题描述】:
可能的重复:
Output of multiple post and pre increments in one statement
Post-increment and pre-increment in 'for' loop
以下代码sn-p
int i=0;
printf("%d %d",i++,i++);
给出输出
1 0
我可以理解,但是下面
int i=0;
printf("%d %d",++i,++i);
给出输出
2 2
谁能解释一下第二种行为?
【问题讨论】:
-
这开始闻起来很像家庭作业,尤其是在您上一个问题之后:stackoverflow.com/questions/4706199/…
-
我只是在很长一段时间后从头开始学习C,我得到了这些疑问:D
-
也许交叉引用的最佳答案是Undefined behaviour and sequence points。
标签: c++ c operator-precedence