Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>free</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
free

Usage


   #include <stdlib.h>
   void free(void *p);

   ANSI

Description

   free releases memory pointed to by p. p must have been allocated using
   calloc, malloc, or realloc. p can be NULL, in which case free does
   nothing

   Caution-do not free data items more than once or refer to data after it
   has been freed.

   If free detects that the heap has become corrupted it will abort the
   program with an error messsage: Heap is corrupted!

Example 

   #include <stdio.h>

   #include <stdlib.h>

   int main()
   {
       char *p;
       if((p = malloc(1000)) == NULL) {
           printf("Unable to allocate memory\n");
           return EXIT_FAILURE;
       }
       free(p);
       return EXIT_SUCCESS;
   }

See Also

   calloc, malloc, realloc



See Also: calloc malloc realloc

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson