Makes available for reallocation the area allocated by a previous calloc, malloc, or realloc call. Format #include <stdlib.h> void free (void *ptr);
1 – Argument
ptr The address returned by a previous call to malloc, calloc, or realloc. If ptr is a NULL pointer, no action occurs.
2 – Description
The ANSI C standard defines free as not returning a value; therefore, the function prototype for free is declared with a return type of void. However, since a free can fail, and since previous versions of the C RTL have declared free to return an int, the implementation of free does return 0 on success and -1 on failure.