函数fun它的功能是:实现两个字符串的链接(不使用库函数strcat),即把p2所指的字符串链接到p1所指的字符串后。
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
void fun(char p1[], char p2[])
{
char *p, *q;
p = p1;
q = p2;
while (*p) p++;
while (*q) *p++ = *q++;
*p = '\0';
}
int main()
{
char s1[80], s2[40];
printf("Enter s1 and s2:\n");
scanf("%s%s", s1, s2);
printf("s1=%s\n", s1);
printf("s2=%s\n", s2);
fun(s1, s2);
printf("Afterinvoking :\n");
printf("%s\n",s1);
getchar();
getchar();
return 0;
}