What are the different dynamic memory management functions in C?
C provides 4 library functions to achieve memory management dynamically. malloc(): This method is used to allocate specified single block of memory dynamically. On success malloc returns pointer, that holds the address of first byte and on failure it returns null pointer. Here typecasting is required as malloc returns pointer of type void. Its syntax is void *malloc(size_t size).Here the allocated memory contains by default garbage values. calloc(): This method is used to allocate specified blocks of memory dynamically of specified type. On success malloc returns pointer holding address of allocated memory and on failure it returns null pointer. Its syntax is void *calloc(size_t n ,size_t size). Here allocated memory is initialized with zero. realloc(): This method is used to modify the already size of already allocated memory i.e., reallocation. Its syntax is void *realloc(void *ptr, size_t size). We can achieve malloc and calloc functionality using realloc with specified inputs. On failure this method returns null pointer. free(): This method is used deallocate the allocated memory. This method returns nothing. Its syntax is void free(void *ptr). These functions are defined in stdlib.h header file. So this header file need to be included to use them. .sk