// Abstract Data Type Stack demo
// Marc Chee, April 2021

// This file describes the interface to a stack of ints
// It must be included in other code files to be of use

// ======================================================
// The type "Stack" refers to a stack_internals pointer.
// In other files, programs can use Stack, but they will
// not get direct access to the stack's internal workings
// nor will they know exactly what they are
typedef struct stack_internals *Stack;

// ======================================================
// These functions are the only way external code can
// manipulate a stack.

// functions to create and destroy stacks
Stack stack_create(void);
void stack_free(Stack s);

// Add and remove items from stacks
// Removing the item returns the item for use
void stack_push(Stack s, int item);
int stack_pop(Stack s);

// Check on the size of the stack
int stack_size(Stack s);

Resource created Wednesday 27 January 2021, 01:16:15 PM, last modified Tuesday 13 April 2021, 05:37:10 PM.

file: stack.h


Back to top

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