有以下程序 #include <stdio.h> #include <string.h> main() { printf("%d\n", strlen("0\t\n\0C011\1")); } 程序运行后的输出结果是

admin2020-07-28  19

问题 有以下程序
#include   <stdio.h>
#include   <string.h>
main()
{
    printf("%d\n", strlen("0\t\n\0C011\1"));
}
程序运行后的输出结果是

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

答案A

解析 C语言转义字符是一个字符。字符串0\t\n\0C011,共有0,\t, \n三个字符。strlen()遇到\0计数结束,因此计数为3,故答案为A选项
转载请注明原文地址:https://jikaoti.com/ti/MJD0FFFM
0

最新回复(0)