选择题
34.
有以下程序:
#include<stdio.h>
void fun(char*t,char*s)
{ while(*t!=0)t++;
while((*t++=*s++)!=0);
}
main()
{ char ss[10]="acc",aa[10]="bbxxyy";
fun(ss,aa);printf("%s,% s\n",ss,aa);
}
程序的运行结果是______。
A、
acc,bbxxyy
B、
accxxyy,bbxxyy
C、
accbbxxyy,bbxxyy
D、
accxyy,bbxxyy
【正确答案】
C
【答案解析】
fun()函数中,第1个while循环语句使指针t指向字符串的末尾,第2个while循环语句实现了字符串t和s的连接。主函数中语句fun(ss,aa)的功能是将字符串aa连接到字符串ss的末尾。
提交答案
关闭