// 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 Wednesday 27 January 2021, 01:16:15 PM, last modified Tuesday 13 April 2021, 05:33:52 PM.

file: main.c


Back to top

COMP1511 21T1 (Programming Fundamentals) is powered by WebCMS3
CRICOS Provider No. 00098G