请教(++x)*(++x)*(++x)问题
量子人生 2010-10-05 09:16:55 代码(在dev中编写):
#include <stdio.h>
#define CUBE(x) ((x)*(x)*(x))
main(){
int x,y,z,s;
x=5;
y=CUBE(++x);
x=5,z=1;
int i;
for (i=0;i<3;i++)
{
z*=(++x);
}
x=5;
s=(++x)*(++x)*(++x);
// printf("x is %d\n",x);
printf("y is %d\n",y);
printf("z is %d\n",z);
printf("s is %d\n",s);
system("pause");
}
结果:
y is 392
z is 336
s is 392
请按任意键继续. . .
希望大家给出解释。s按照一本参考书期望的值应该是8的立方。感觉y应该与z的值一样,为什么会出现这种结果。