#include <cstdio>
#include<iostream>
#include<cstring>
using namespace std;
char *catstr(char *a,char *b)
{
char *p=a,*q=b;
while(*p) p++;
while(*q)*p++=*q++;
*p='\0';
return a;
}
int main()
{
char str1[105];
char str2[105];
gets(str1);
gets(str2);
cout<<"str1+str2="<<" "<<catstr(str1,str2)<<endl;
return 0;
}
用自定义函数和指针实现功能
转载于:https://www.cnblogs.com/mingrigongchang/p/6246288.html