free() function in C

This “free() function in C” is providing clear information about how to use free() function to de-allocate memory which is allocated by calloc or realloc or malloc in C programming.


 

free() :

  • free() function is used to de-allocate the memory.
  • We can allocate memory using malloc, calloc and realloc functions.
  • Prototype of free() function as follows…
    • void free(void* ptr);

 

Note:

  • It is impossible to delete the information in the memory.
  • We can make the pointer not pointing to the data location.
  • free() function provides information to OS to de-allocate the memory which is currently occupied by the specified pointer.

 

Share this