#include < stdio.h>
#include < stdlib.h>
char* strcat_self(char *strFrist,char *strSecond){
int i=0,j=0;
static char newstr[20];
char *p;
p = newstr;
while(*(strFrist+i)!=’\0’){
(p+i) = (strFrist+i);
i++;
}
while(*(strSecond+j)!=’\0’){
(p+i) = (strSecond+j);
i++;
j++;
}
return newstr;
}
int main() {
char str1[20],str2[20],*newstr;
printf(“请输入第一个字符串:\n”);
gets(str1);
printf(“请输入第二个字符串:\n”);
gets(str2);
newstr = strcat_self(str1,str2);
printf(“字符串1:%s 字符串2:%s 连接后:%s\n”,str1,str2,newstr);
return 0;
}