首页 > 其他 > 详细

内存相关函数

时间:2017-05-24 09:17:33      阅读:225      评论:0      收藏:0      [点我收藏+]

总是记不住内存相关函数的API,特此记录。

1. malloc

void* malloc (size_t size);

Allocates a block of size bytes of memory, returning a pointer to the beginning of the block.
The content of the newly allocated block of memory is not initialized, remaining with indeterminate values.

2. free

void free (void* ptr);

A block of memory previously allocated by a call to malloccalloc or realloc is deallocated, making it available again for further allocations.
If ptr does not point to a block of memory allocated with the above functions, it causes undefined behavior.
If ptr is a null pointer, the function does nothing.

3. memcpy

void * memcpy ( void * destination, const void * source, size_t num );

Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination.

4. memmove

void * memmove ( void * destination, const void * source, size_t num );

Copies the values of num bytes from the location pointed by source to the memory block pointed by destination. Copying takes place as if an intermediate buffer were used, allowing the destination and source to overlap.

内存相关函数

原文:http://www.cnblogs.com/gattaca/p/6897202.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!