有下面程序段 #include "stdio.h" #include "string.h" main() {char a[3][20]={{"chin
有下面程序段
#include "stdio.h"
#include "string.h"
main()
{ char a[3][20]={{"china"},{"isa"},{"bigcountry!"}};
char k[100]={0},*p=k;
int i;
for(i=0;i<3;i++)
{ p=strcat(p,a[i]);}
i=strlen(p);
printf("%d\n",i);}
则程序段的输出结果是
A.18
B.19
C.20
D.21
正确答案:B解析:字符串连接函数strcat的调用形式如下:strcat(s1,s2)。此函数将s2所指字符串的内容连接到s1所指的字符串后面,并自动覆盖s1串末尾的尾标,函数返回s1的地址值。
词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。
