设已执行预编译命令#include<string.h>,以下程序段的输出结果是( )。 char s[]=" an apple" ; printf(" %d\n" ,strlen(s));

admin2009-02-15  29

问题 设已执行预编译命令#include<string.h>,以下程序段的输出结果是(    )。    char s[]="  an apple"  ;    printf("  %d\n"  ,strlen(s));

选项 A、7
B、8
C、9
D、10

答案2

解析 如果一个字符数组中存放一个字符串,则函数strlen的值为“\0”之前的全部字符个数,也包括空格在内。注意:字符串处理函数的使用。
转载请注明原文地址:https://kaotiyun.com/show/YvXp777K
0

最新回复(0)