//pop.c //John T. Rine //October 13, 2011 #include"all.h" #include #include int pop(node **head, node **tail) { int data = 0; node *temp = NULL; temp = *tail; if(*head != NULL && *tail != NULL) { if (temp == *head) { temp->next = NULL; data = temp->data; free(temp); *head = *tail = NULL; } else { temp->prev->next = NULL; *tail = temp->prev; temp->prev = NULL; data = temp->data; free(temp); } } else { printf("No stack to pop...\n"); exit(1); } return data; }