不使用库函数strcat(),自行编程实现str_append()功能:已知两个字符串,将这两个字符串拼接起来作为返回值。例如函数输入参数为“Hello”和"World",那么返回值就是"HelloWorld";
#include <stdio.h>
#include <string.h>
char str_append(char s[],char t[])
{
int i,j;
i=j=0;
while(s[i]!='\0')
i++;
while((s[i++]=t[j++])!='\0');
}
main()
{
char s[]="hello";
char t[]="world";
str_append(s,t);
printf("%s",s);
}