#include<string.h>
char insert(char s1[],char s2[])
{
char s3[40]={0};
int len1,len2, i = 0;
len1 = strlen(s1);
len2 = strlen(s2);
for(i=0;i<=len1;i++)
{
s3[i]=s2[i];
}
for(i=0;i<(len1+len2);i++)
{
s3[i+len2]=s1[i];
}
printf("字符串2插入到字符串1後結果為:\n%s\n\n",s3);
return s3;
}
int main()
{
char s1[20];
char s2[20];
printf("請輸入第一個字符串,並以回車鍵結束!\n");
gets (s1);
printf("請輸入第二個字符串,並以回車鍵結束!\n");
gets(s2);
insert(s1,s2);
return 0;
}