c語言如何實現(xiàn)內(nèi)存復(fù)制
void *memmove(void *dest, const void *src, size_t count)
{
assert((src != NULL)&&(dest != NULL));
char *tmp, *s;
if (dest <= src)
{
tmp = (char *) dest;
s = (char *) src;
while (count--)
*tmp++ = *s++;
}
else {
tmp = (char *) dest + count;
s = (char *) src + count;
while (count--)
*--tmp = *--s;
}
return dest;
*博客內(nèi)容為網(wǎng)友個人發(fā)布,僅代表博主個人觀點,如有侵權(quán)請聯(lián)系工作人員刪除。