试题与答案

有以下程序: #include<stdio.h> main() int a=

题型:单项选择题

题目:

有以下程序:
#include<stdio.h>
main()
int a=2,b=2,c=2;
Printf("%d\n",a/b&c);

程序运行后的输出结果是( )。

A.0

B.1

C.2

D.3

答案:

参考答案:A

解析: 根据C语言运算符的优先级与结合性,先计算a/b,结果为1,再将a/b的结果与c做按位与运算,即1与2做按位与运算,其结果为0。

试题推荐
微信公众账号搜索答案