Standard memory functions.
Frees previously allocated memory.
- Parameters
-
ptr | The memory buffer to free. |
Allocates a requested amount of memory.
- Parameters
-
size | The number of bytes to allocate |
- Returns
- A pointer to the allocated memory or NULL on error.
void * memcpy |
( |
void * |
dest, |
|
|
const void * |
src, |
|
|
size_t |
n |
|
) |
| |
Copies n bytes from src to dest.
- Parameters
-
dest | The pointer to the destination memory region |
src | The pointer to the source memory region |
n | The number of bytes to copy |
void * memmove |
( |
void * |
dest, |
|
|
const void * |
src, |
|
|
size_t |
n |
|
) |
| |
Copies n bytes from src to dest by first copying to a temporary area first, allowing dest and src to potentially overlap.
This can be used to move data to a location that overlaps its previous location.
- Parameters
-
dest | The pointer to the destination memory region |
src | The pointer to the source memory region |
n | The number of bytes to copy |
void * memset |
( |
void * |
dest, |
|
|
int |
c, |
|
|
size_t |
n |
|
) |
| |
Sets n bytes to c starting at dest.
This can be used to clear a memory region for example if c is 0.
- Parameters
-
dest | The pointer to the destination memory region |
c | The integer used as an unsigned char to assign to each byte |
n | The number of bytes to set |
size as an unsigned integer