本题要求实现一个函数,将两个字符串连接起来。
函数接口定义:
函数str_cat
应将字符串t
复制到字符串s
的末端,并且返回字符串s
的首地址。
裁判测试程序样例:
我的代码:
char *str_cat( char *s, char *t )
{
char *p=s;//记录字符串s的首地址
while(*s!='\0')
{
s++;
}
while(*t!='\0')
{
*s=*t;
s++;
t++;
}
return p;
}