/*Frees the list by cycling through and calling destroyRecord for each individual record*/ void freeList(struct car * theList) { struct car * current; struct car * next; current = theList; next = theList->next; while(current->next!=NULL) { next = current->next; destroyRecord(current); free(current); current = next; } theList = NULL; }
void destroyList( MusicRec * theList ) { MusicRec * temp; do { destroyRecord( theList ); temp = theList; theList = theList->next; free(temp); } while( theList != NULL ); return; }