C free function

« Previous

Synopsis:

Example

#include <stdio.h>
void free(void *mem_address); 

Description:

A block of memory previously allocated using a call to malloc, calloc or realloc is deallocated, making it availbale again for further allocations.

Return Value

None.

Example

Example

#include <stdio.h>
int main ()
{
  int * buffer1, * buffer2, * buffer3;
  buffer1 = (int*) malloc (100*sizeof(int));
  buffer2 = (int*) calloc (100,sizeof(int));
  buffer3 = (int*) realloc (buffer2,500*sizeof(int));
  free (buffer1);
  free (buffer3);
  return 0;
}

Output Will Be :

Output

This program has no output.
This is just demonstration of allocation and deallocation of memory.


« Previous
Have Any Suggestion? We Are Waiting To Hear from YOU!

Your Query was successfully sent!