#include <stdio.h>
#include <assert.h>
char* My_Strcpy(char* str1, const char* str2)
{
assert(str1);//指针不为空
assert(str2);//指针不为空
char* ret = str1;
while(*str1++ = *str2++);
return ret;
}
int main()
{
char arr1[10] = "abcdef";
char arr2[] = "klj";
printf("%s\n",My_Strcpy(arr1,arr2));
return 0;
}
C语言:自定义实现strcpy函数
最新推荐文章于 2023-08-07 20:30:07 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)