x+=y+=z; printf("%d\n",z+=x>y?x++:y++);过程是怎么的?int x=1,y=2,z=3;x+=y+=z;printf("%d\n",z+=x>y?x++:y++);x=y=z=-1;(++x||(++y&&++z));printf("%d %d %d\n",x,y,z);
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/24 10:15:55
x+=y+=z; printf("%d\n",z+=x>y?x++:y++);过程是怎么的?int x=1,y=2,z=3;x+=y+=z;printf("%d\n",z+=x>y?x++:y++);x=y=z=-1;(++x||(++y&&++z));printf("%d %d %d\n",x,y,z);
x+=y+=z; printf("%d\n",z+=x>y?x++:y++);过程是怎么的?
int x=1,y=2,z=3;
x+=y+=z;
printf("%d\n",z+=x>y?x++:y++);
x=y=z=-1;
(++x||(++y&&++z));
printf("%d %d %d\n",x,y,z);
x+=y+=z; printf("%d\n",z+=x>y?x++:y++);过程是怎么的?int x=1,y=2,z=3;x+=y+=z;printf("%d\n",z+=x>y?x++:y++);x=y=z=-1;(++x||(++y&&++z));printf("%d %d %d\n",x,y,z);
x+=(y+=z);先计算右边 y+=z的意思是y=y+z,所以x+=x+y=x+y+z=6
z+=x>y?x++:y++ 先判断那个大,很明显是x>y,x++是要先取值后才加一,此时z+=x,z=x+z=6+3=9
(++x||(++y&&++z))先算最里面的括号,顺序从左往右.++y是先加一再取值,此时y=0,0与任何一个数做与运算都是0,所以++z就不运行了,z还是为-1.++x||0,0与任何一个数做或运算不一定都是0,所以++x的值要算,所以x=0
运行结果:
9
0 0 -1
45XXX54555 45XXX545XXX545XXX545XXX545XXX545XXX545XXX545XXX545XXX545XXX
全部展开
45XXX54555 45XXX545XXX545XXX545XXX545XXX545XXX545XXX545XXX545XXX545XXX545XXX545XXX545Xup>545XXX545XXX545XXX545XXfgfg₀D₁ D₈6&sup5eW78&sup5
收起