Possible Duplicate:
Could anyone explain these undefined behaviors (i = i++ + ++i , i = i++, etc…)
main()
{
int a=5;
a= a++ + ++a + ++a + a++ + a++;
printf("%d",a);
}
最佳答案
这没有定义。
您可以找到 C 标准 2005 年 5 月 6 日起的委员会草案 here (pdf)
请参阅6.5 表达式
部分:
2 Between the previous and next sequence point an object shall have its stored value modified at most once by the evaluation of an expression. Furthermore, the prior value shall be read only to determine the value to be stored.
和示例:
71) This paragraph renders undefined statement expressions such as
i = ++i + 1;
a[i++] = i;
关于c - 怎么答案是36?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2935009/