free

Syntax:

    #include <cstdlib>
    void free( void* ptr );

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(). An example:

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

Related Topics: calloc, delete, malloc, new, realloc