//destroyFixedStack.c //John T. Rine //October 12, 2011 #include #include #include"all.h" void destroyFixedStackHead(node **head, node **tail) { node *temp; node *temp2; temp = NULL; temp2 = NULL; temp = *head; while(temp != NULL) { temp2 = temp->next; if (temp->prev != NULL) temp->prev = NULL; if (temp->next != NULL) temp->next = NULL; free(temp); temp = temp2; } *head = *tail = NULL; } void destroyFixedStackTail(node **head, node **tail) { node *temp; node *temp2; temp = NULL; temp2 = NULL; temp = *tail; while(temp != NULL) { temp2 = temp->prev; if (temp->prev != NULL) temp->prev = NULL; if (temp->next != NULL) temp->next = NULL; free(temp); temp = temp2; } *head = *tail = NULL; }