A-A+
有以下程序: include <stdio.h> main() { int n=0 m=1
问题详情
有以下程序: include <stdio.h> main() { int n=0,m=1,x=2; if(! n)x-=1; if(m) x-=2; if(x) x-=3; printf("%dn",x); } 执行后的输出结果是【 】。
请帮忙给出正确答案和分析,谢谢!
参考答案
正确答案:-4
因为n=0,所以!n为真,执行x-=1;得到x=x=2-1=1;m=1为真,执行x-=2;得到x=x-2=1-2=-1;x=-1为真,执行x-=3;得到x=x-3=-1-3=-4。