free ( ) Function
Memory is a limited resource.
One should allocate exactly the sized piece of memory before you need it, and
release it as soon as you don’t need it.
the free ( ) function release the memory space allocated previously by
a previous call to the malloc ( ),
calloc ( ) or realloc ( ). Its declaration is of the form,
void
free ( void *block );
The realloc ( ) function can behave the same as free ( ) function provided the second argument passed to realloc ( ) is 0. So, in order to free
memory allocated to a pointer ptr, we
write
free (
ptr );
which is equivalent to
realloc
( ptr, 0);
Post a Comment