Difference between realloc() and free?

Asked 12-Dec-2017
Viewed 1205 times

1 Answer


0

Both realloc() and free() are functions of C programming language used for dynamic memory allocation. Both of the functions are defined in the stdlib.h library. 

realloc() : It is a function which is used to dynamically reallocate memory space to an already dynamically allocated memory space to a variable.

free() : It is used to deallocate or free the dynamically allocated memory space allocated to a variable and thus make it available to other variables or other memory functions of the operating system.

Difference between realloc() and free?

Image for free() function

Difference between realloc() and free?

Image for realloc() functions