有以下程序 #include <stdio.h> main() { char a=3, b=6, c; c=(a^b)<<2; printf("%d \n", c ); } 程序运行后的输出结果是

admin2020-07-28  23

问题 有以下程序
#include  <stdio.h>
main()
{  char  a=3, b=6, c;
   c=(a^b)<<2;
   printf("%d \n", c );
}
程序运行后的输出结果是

选项 A、5
B、1
C、20
D、18

答案C

解析 ^运算符为按位异或运算符,即0^1=1,1^0=1,1^1=0,0^0=0,因此a^b=101
在进行<<操作,变为101002=2010,因此答案为C选项。
转载请注明原文地址:https://kaotiyun.com/show/bJ3p777K
0

最新回复(0)