int x=6; x += x -= x * x; printf("x = %d\n",x);
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/04 23:59:40
int x=6; x += x -= x * x; printf("x = %d\n",x);
int x=6;
x +=( x -= x * x);
等价于:
x=(x+=(6-(6*6)))=(x+=-30)=-60;
再问: ( x -= x * x)为什么是同时赋值6
再答: 因为有个等号,所以需要先保存x=6,再计算x*x,然后计算x-=36,而这时会改变x的值,所以x+=中不会直接保存x=6而是等(6-(6*6))计算完才计算x+=result; 换句话是说: ①(x-=x*x)等价于:tmp1=x;tmp2=x*x; x=tmp1-tmp2; ②(x+=result)等价于:tmp1=x; tmp2=result=x; x=tmp1+tmp2=2*tmp1=2*x;
x +=( x -= x * x);
等价于:
x=(x+=(6-(6*6)))=(x+=-30)=-60;
再问: ( x -= x * x)为什么是同时赋值6
再答: 因为有个等号,所以需要先保存x=6,再计算x*x,然后计算x-=36,而这时会改变x的值,所以x+=中不会直接保存x=6而是等(6-(6*6))计算完才计算x+=result; 换句话是说: ①(x-=x*x)等价于:tmp1=x;tmp2=x*x; x=tmp1-tmp2; ②(x+=result)等价于:tmp1=x; tmp2=result=x; x=tmp1+tmp2=2*tmp1=2*x;
int x=6; x += x -= x * x; printf("x = %d\n",x);
int x=20; printf("%d\n",x);
void main() {int x=4;if(x++>=5)printf("%d/n",x);else printf(
main() { int x=10; int y=x++; printf("%d,%d\n",(x++,y),y++);
int x=20;printf(“%d”,0
main( ) {int x=3; do {printf("%d\n",x-=2;} while (--x)); }
#includemain(){int x=3;do{printf("%3d\n",x-=2);}while(!(--x)
#includemain(){int x=3;do{printf("%d\n",x-=2);}while(!(--x))
main() {int x=10,i=1,j=2; printf (“%d,%o,%x\n”,x,x,x); print
main(){int n=6,x;x=f(n);printf("%d!=%d\n",n,x);}f(int n){int
int x=12,y=8; printf("%d\t%d\t%d\n",x,x&y,x|y);
int x=10,y=20; main() {func();printf("%d,%d\n",x,y);} func()