有以下程序: #include<stdio.h> main() {int a=1,b=2,c=3,x; x=(a^b)&c; printf("%d\n",x); } 程序的运行结果是( )。

admin2019-08-10  23

问题 有以下程序:
#include<stdio.h>
main()
{int a=1,b=2,c=3,x;
x=(a^b)&c;
printf("%d\n",x);
}
程序的运行结果是(    )。

选项 A、3
B、1
C、2
D、0

答案A

解析 本题考查位运算符以及相关运算。^为按位或,&为按位与,那么a^b为3,再与c按位与仍然为3,所以答案为A选项。
转载请注明原文地址:https://kaotiyun.com/show/lcRp777K
0

最新回复(0)