Just to clear this up and return to what is being affectionatally termed CS 1, I'm posting a piece from a book named C: A reference manual, Fourth Edition. The important part of this is probably the last paragraph. free ISO C facilities Traditional and alternate facilities void free(void *ptr); void free(char *ptr); void cfree(char *ptr); The ISO function free deallocates a region of memory previously allocated by malloc, calloc, or realloc. The traditional version of free deallocates memory previously allocated by malloc, mlalloc, realloc, or relalloc. The traditional C function cfree deallocates memory previously allocated by calloc or clalloc. The argument to free or cfree must be a pointer that is the same as a pointer previously returned by one fo the allocation functions. If the argument to the ISO C free function is a null pointer, then the call has no effect. However, passing a null pointer to a traditional free or cfree function is known to cause trouble in many non-ISO C implementations. Once a region of memory has been explicitly freed (or reallocated), it must not be used for any other purpose. The use of any pointer into the region (a "dangling pointer") will have unpredictable effects. Likewise, allocating a region of storage once but freeing it more than once has unpredictable effects. I hope that helps. If not, best get a (better) book. Mark (I am always amazed at the knowledge that one can find in a book).
This archive was generated by hypermail 2b30 : 12/18/00 PST