Dynamic allocation is a unique feature to C. It enables us to
create data types and structures of any size and length to suit our
programs need within the program. We use dynamic memory allocation
concept when we don't know how in advance about memory requirement.
There are following functions to use for dynamic memory manipulation:
There are following functions to use for dynamic memory manipulation:
- void *calloc(size_t num elems, size_t elem_size) - Allocate an array and initialise all elements to zero .
- void free(void *mem address) - Free a block of memory.
- void *malloc(size_t num bytes) - Allocate a block of memory.
- void *realloc(void *mem address, size_t newsize) - Reallocate (adjust size) a block of memory.
No comments:
Post a Comment