stdlib.h
Methods
Return | Method |
---|---|
void* |
malloc( size_t size ) |
void* |
calloc( size_t n_items, size_t size ) |
void* |
realloc( void *ptr, size_t size ) |
void |
free( void *ptr ) |
Method Descriptions
void *malloc( size_t size )
m
emory alloc
ation
Dynamically allocates a single block of contiguous memory according to size
, containing garbage.
Returns a void
pointer pointing to the first byte of allocated memory, otherwise it returns NULL
if unsuccessful.
void *calloc( size_t n_items, size_t size )
c
lear alloc
ation
Dynamically allocates multiple blocks of memory by n_items
blocks sized according to size
, containing zeroes.
Returns a void
pointer pointing to the first byte of allocated memory, otherwise it returns NULL
if unsuccessful.
void *realloc( void *ptr, size_t size )
realloc
ation
Attempts to change the size of the memory block by size
, pointed to by ptr
. Newly allocated bytes are not initialized.
Returns a void
pointer pointing to the first byte of newly allocated memory, otherwise it returns NULL
if unsuccessful.
void free( void *ptr )