free()

Syntax:

 #include <stdlib.h>



Description:
The free() function deallocates the space pointed to by ptr, freeing it up for future use. ptr must have been used in a previous call to |malloc()|, |calloc()|, or |realloc()|.

Example:

typedef struct data_type {
  int age;
  char name[20];
} data;
    
data *willy;
willy = (data*) malloc( sizeof(willy) );
...
free( willy );



Related Topics:
calloc(), malloc(), realloc()

Vadim avatar

Vadim