#include<stdio.h>
#include<Windows.h>
#include<assert.h>
char *my_strcpy(char *dst, const char *src)
{
assert(*dst !=NULL);
assert(*src !=NULL);
char *ret = dst;
while (*dst++ = *src++)
{
;
}
return ret;
}
int main()
{
char arr1[10] = {'0'};
char *arr2 = "hello world!";
printf("%s\n", my_strcpy(arr1, arr2));
system("pause");
return 0;
}
模拟实现strcpy函数
最新推荐文章于 2023-10-03 06:00:00 发布