[prev] [index] [next]

List Operations (cont)

Another important list operation:
  • free all the nodes in a list
Implementation:

void freeList(NodeT *list) {
	NodeT *cur;

	cur = list;
	while (cur != NULL) {
		NodeT *tmp = cur->next;
		free(cur);
		cur = tmp;
	}
}