free()                   Deallocate Memory Block
 
 #include   <malloc.h>                   Required for declarations only
 
 void       free(ptr);
 char       *ptr;                        Pointer to already allocated block
 
    free() deallocates the previously allocated memory block pointed to
    by 'ptr'.  The block must have been allocated by calloc() or malloc()
    and may have been reallocated or resized by realloc().  This makes
    the memory in the block available for reallocation.
 
    Returns:    There is no return value.
 
      Notes:    free() deallocates the number of bytes that were
                allocated in the call to calloc(), malloc(), or
                realloc().
 
  -------------------------------- Example ---------------------------------
 
    The following statements allocate space for 1000 bytes and then free
    the allocated space.
 
           #include <malloc.h>
           #include <stdio.h>      /* for printf and NULL */
 
           char *memptr;
 
           main()
           {
               if ((memptr = malloc(1000)) == NULL)
                    printf("not enough room to allocate memory\n");
               else {
                    .
                    .
                    free(memptr);
                }
           }

Seealso:



This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster