The various memory allocation functions are described below:
(i) malloc( ): It is a memory allocation function that assigns requested size of bytes and returns a pointer to the first byte of the allocated space. The malloc function returns a pointer of type void so we can allocate it to any type of pointer.
(ii) calloc( ): It is another memory allocation function that assigns space for an array of elements, initializes them to zero and then returns a pointer to the memory. This function is normally used for request memory space at run time. Whereas malloc allocates a single block of storage space, calloc allocates multiple block of storage, each of the similar size, and then sets all bytes to zero
(iii) realloc( ): realloc is a memory allocation function that changes the size of previously allocated space. Sometime it may happen that the allocated memory space is larger than what is needed or it is less than what is needed. In both cases, we can change the memory size already allocated with the help of the realloc function called as reallocation of memory