有以下程序 #include<stdio.h> voidfun(char*t,char*s) {while(*t!=0)t++; while((*t++=*s++)!=0); } main( ) {charss[10]=’’acc’’,aa[10]=

admin2014-06-19  19

问题 有以下程序
#include<stdio.h>
voidfun(char*t,char*s)
{while(*t!=0)t++;
while((*t++=*s++)!=0);
}
main(    )
{charss[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的末尾。
转载请注明原文地址:https://kaotiyun.com/show/iYJp777K
0

最新回复(0)