#include<stdio.h>
#include<string.h>
#include<assert.h>
char* My_strcat(char* p1, char* p2)
{
assert(p1 && p2); //断言一下传进来的不是野指针
char* start = p1;
while (*p1 != '\0')
{
p1++;
}
*p1 = *p2;
while (*p2 != '\0')
{
*p1 = *p2;
p2++;
p1++;
}
return start;
}
int main()
{
char arr1[30] = { "STRCAT TEST "};
My_strcat(arr1, "SUCCEED 2");
printf("%s", arr1);
return 0;
}
10-29
298
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
05-26