有以下程序 #include <stdio.h> main( ) { int x = 0x13; if (x = 0x12) printf("True"); printf("False\n"); } 程序运行后的输出结果是

admin2021-07-09  25

问题 有以下程序
#include   <stdio.h>
main( )
{
    int  x = 0x13;
    if (x = 0x12)   printf("True");
    printf("False\n");
}
程序运行后的输出结果是

选项 A、True
B、TrueFalse
C、False
D、TrueFalseTrue

答案B

解析 if(x=0x12)表示x=0x12!=0即x=0x12为假时,执行printf("True"),再执行printf("False\n"),因此答案为B选项,注意赋值操作符"="与相等操作符"=="的区别。
转载请注明原文地址:https://kaotiyun.com/show/b7tp777K
0

最新回复(0)