两个字符串合并代码 哪一步出了错
#include<iostream>using namespace std;
int link(char *p1,char *p2)
{
int i=0;
int j=0;
char *p;
if(p1==NULL||p2==NULL)
{
printf("func p1==NULL||p2==NULL err\n");
}
p=p1;
while(p[i]='\0')
{
i++;
}
while(p2[j]!='\0')
{
p[i++]=p2[j++];
}
p[i+j]='\0';
return 0;
}
int main()
{
char buf1[]="2354jkf";
char buf2[]="abcdefg";
link(buf1,buf2);
cout<<buf1<<endl;
system("pause");
}