void * my_memcpy(void *dest, void *src, unsigned count)
{
if (dest == NULL || src == NULL)
{
return NULL;
}
char* pdest = (char*)dest;
char* psrc = (char*)src;
while (count--)
{
*pdest++ = *psrc++;
}
return dest;
}
int main()
{
char src[] = "hello";
char dest[] = "world";
my_memcpy(dest, src, strlen(src));
printf("%s", dest);
system("pause");
return 0;
}
memcpy的实现
最新推荐文章于 2024-07-30 15:31:23 发布