Dynamic Memory Allocation Function
How to allocate space using Dynamic Memory Allocation Function in C++?
Explanation
Dynamic Allocation Function are used to allocate space or memory dynamically or at run time. The header file used by the dynamic allocation functions is "
<cstdlib>".
Different C++ compilers support these functions in different variants, to accommodate various options and environmental differences. Following table lists some basic dynamic memory allocation function to allocate space.
Name | Description |
calloc | Allocates memory of the specified size |
free | Returns the memory pointed by the pointer. |
malloc | Returns a pointer to the first byte of the memory. |
realloc | Changes the size of the previously allocated. |