#include <stdio.h>
int main()
{
int p=10,q=20,r;
if(r = p = 5 || q > 20)
printf("%d",r);
else
printf("No output");
return 0;
}
输出是1但是怎么办? 请解释一下
最佳答案
Precedence 。更清楚地说:
if(r = p = 5 || q > 20)
与
相同if(r = p = (5 || q > 20))
5 为真,因此 bool 表达式的计算结果为 1,然后将其赋值给 r
关于c - C 程序的输出是什么?为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57208499/