// Abstract Data Types Demo
// Using a stack
// Marc Chee, April 2019

#include <stdio.h>

#include "stack.h"

int main(void) {
    stack deck = stackCreate();
    int card = 42;
    printf("Pushing %d on top of the deck.\n", card);
    stackPush(deck, card);
    card = 37;
    printf("Pushing %d on top of the deck.\n", card);
    stackPush(deck, card);
    card = 13;
    printf("Pushing %d on top of the deck.\n", card);
    stackPush(deck, card);
    
    printf("Taking %d off the top of the deck.\n", stackPop(deck));
    printf("Taking %d off the top of the deck.\n", stackPop(deck));
    printf("Taking %d off the top of the deck.\n", stackPop(deck));
}

Resource created Tuesday 23 April 2019, 02:01:24 AM, last modified Wednesday 24 April 2019, 03:45:57 PM.

file: main.c


Back to top

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