/* * singlystack.c - singly linked list stack implementation * */ #include "mystack.h" int main() { Node *tmp; int input = 0; printf("Enter a value (-1 to stop): "); scanf("%d", &input); stack = top = NULL; while (input != -1) { push(input); printf("Enter a value (-1 to stop): "); scanf("%d", &input); } printf("Stack created. Popping time.\n"); while ((tmp = pop()) != NULL) { printf("POPPED: %d\n", tmp -> value); free(tmp); } printf("POPPED: NULL\n"); return(0); }