以下程序的输出结果是_____.
# include
main()
{ printf(“%d\n”,strlen(“IBM\n012\1\\”));
}
第1题:
有以下程序
#include
main()
{ char str[][20]={"Hello","Beijing"},*p=str;
printf("%d\n",strlen(p+20));
}
程序运行后的输出结果是
A.0
B.5
C.7
D.20
第2题:
有以下程序: #include <string.h> main() {char *p="abcde\Ofghjik\0"; printf("%d\n",strlen(p)); } 程序运行后的输出结果是( )。
A.12
B.15
C.6
D.5
第3题:
有以下程序:
include<stdio.h>
include<strin9.h>
main( )
{printf{"%d\n",strlen("%d\n",strlen("ATS\n012\|"));}
程序运行后的输出结果是( )。
A.3
B.8
C.4
D.9
本题考查strlen函数和转移字符,strlen函数的功能是求字符串的长度,在本题中有“\”,C语言中“\”是转义字符,在计算长度时会将转义符以及后面的第一个字符作为1个长度进行计算,所以答
第4题:
有以下程序
#include <stdio.h>
#include <string.h>
main( )
{ printf("%d\n",strlen ("ATS\n012\1") ); }
程序运行后的输出结果是
A)3
B)8
C)4
D)9
第5题:
请读程序片段(字符串内没有空格字符): printf("%d\n",strlen("ATS\n012\1\\"));上面程序片段的输出结果是_______。
A.11
B.10
C.9
D.8