free [C++ Reference]
Keywords: c,mem,free
Date: 2009-04-21T19:32:53-0700

[[free]]
C++ Reference
Translations of this page?:

- en
- br-pt
- cn
- fr
- it
- jp
- pl
- ru
- tr

## 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(*willy) );
         ...
         free( willy ); //lame joke

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

Edit this page • Old revisions
• • • Login • Index • Recent changes • RSS • cc •