2012《中兴软件笔考试题》题4
2012《中兴软件笔试题》题4
//ex_ZTE1_4.c
//《中兴软件笔试题》
/*题4:有以下程序
void main(void)
{
int a,b,d=26;
a=d/10%9;
b=a&&(-1);
printf("%d,%d\n",a,b);
}
程序运行后输出结果为()
A,6,1 B,2,1 C,6,0 D.2,0
答案 B
解释:在C语言中定义非0的数为真,0为假,因此(-1&&-2)=1
*/
#include<stdio.h> void ZTE1_4(void) { int a,b,d=26; a=d/10%9; b=a&&(-1); printf("%d,%d\n",a,b); printf("(-1&&-2)=%d\n",(-1&&-2)); }