#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include<assert.h>
char* my_strcat(char* dest, char* src)
{
assert(dest && src);
char* ret = dest;
//找目标空间中的\0
while (*dest)
{
dest++;
}
//拷贝
while (*dest++ = *src++)
{
;
}
return ret;
}
int main()
{
char arr1[20] = "hello ";
char arr2[] = "bit";
printf("%s", my_strcat(arr1, arr2));
return 0;
}
06-12
1485
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-05
5255
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)