free - release/deallocate memory
Standard C Library (libc, -lc)
free releases a block of memory previously allocated with malloc, calloc, or realloc.
Once free has been called, ptr is no longer valid and attempts to dereference it result in undefined behavior. (Pedantically, in fact, even using the value of ptr may produce undefined behavior.) Passing ptr to free a second or subsequent time (unless of course the same pointer value is again returned from malloc) is also undefined and particularly likely to provoke adverse behavior in most implementations.
free(NULL) has no effect.
In practice it is desirable for implementations of free to detect, to the extent practically possible, pointers that were not previously allocated by one of the above functions or that are passed to free multiple times. However, this can be difficult and there is no useful standard mechanism for error reporting.
free does not necessarily unmap free memory or return it to the operating system, but may do so if it chooses.
free returns no value.
calloc, malloc, realloc