1、基本概念
2、代码实现
#include<stdio.h>
#include<assert.h>
char* My_strcat(char* destination, char* source)
{
char* ret = destination;
assert(destination != NULL);//使用断言函数判断指针是否错误
assert(source != NULL);//使用断言函数判断指针是否错误
while (*destination)
{
destination++;
}
while (*destination++ = *source++)
{
;
}
return ret;
}
int main()
{
char arr1[20] = { "hello"};
char arr2[20] = { "world" };
My_strcat(arr1, arr2);
printf("%s\n", arr1);
return 0;
}