写内存拷贝

写内存拷贝

void *memcpy(void *dest, const void *src, intn);

由src指向地址为起始地址的连续n个字节的数据复制到以dest指向地址为起始地址的空间内。头文件:#include

void * memcpy (void * dst, const void * src, size_t count)

{

       void * ret = dst;

       /*copy from lower addresses to higher addresses*/

       while (count--) {

                *(char *)dst = *(char *)src;

               dst = (char *)dst + 1;

                src = (char *)src + 1;

       }

       return(ret);

}

你可能感兴趣的:(其他)