previous
|
index
|
next
Freeing Linked Structures
To free all the memory taken by linked structures, you must loop through them and for each individual struct you must:
Save a pointer to the front element
Advance the beginning pointer past the front element
Free memory used by front element
void freeList(list lst) { while ( lst != NULL ) { list save = lst;
lst = lst->rest;
} }
previous
|
index
|
next