码迷,mamicode.com
首页 > 其他好文 > 详细

内存相关函数

时间:2017-05-24 09:55:28      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:api   rect   initial   val   undefined   init   beginning   logs   str   

总是记不住内存相关函数的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.

内存相关函数

标签:api   rect   initial   val   undefined   init   beginning   logs   str   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!