// Abstract Data Types Demo
// Using a stack
// Marc Chee, April 2021
#include <stdio.h>
#include "stack.h"
int main(void) {
Stack deck = stack_create();
int card = 42;
printf("Pushing %d on top of the deck.\n", card);
stack_push(deck, card);
card = 37;
printf("Pushing %d on top of the deck.\n", card);
stack_push(deck, card);
card = 13;
printf("Pushing %d on top of the deck.\n", card);
stack_push(deck, card);
printf("Taking %d off the top of the deck.\n", stack_pop(deck));
printf("Taking %d off the top of the deck.\n", stack_pop(deck));
printf("Taking %d off the top of the deck.\n", stack_pop(deck));
}
Resource created 4 years ago, last modified 4 years ago.
file: main.c