Make your own free website on Tripod.com
slide 23

Returning Memory

free(P) returns to he global pool the block of memory that P points to.

To free up all the entries in a linked list, you must call free for each entry. Calling it on the first entry does not free up the following entries.

Now we have no way to free "MARYJANE"'s entry because we forgot to retrieve its address from "JOE"'s entry before we freed it.