Dynamic Memory Allocation is the process of allocating memory to the program and its variables in runtime. Dynamic Memory Allocation process involves three functions for allocating memory and one function to free the used memory.
malloc() – Allocates memory
Syntax:
1 ptr = (cast-type) malloc(byte -size);
calloc() – Allocates memory
Syntax:
1 ptr = (cast-type*)calloc(n, element-size);
realloc() – Allocates memory
Syntax:
1 ptr = realloc(ptr, newsize);
free() – Deallocates the used memory
Syntax
1 free(ptr);