stack - */ int StackSize(Stack S); /* * Function: FullStack...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/* File: stack.h * ------------------------------------------------- * This interface provides the functions for stack ADT * It uses the position-oriented unsorted list-based * ADT. */ #include "list.h" #ifndef _STACK_H #define _STACK_H #define MAX_STACK 1000 #define true 1 #define false 0 typedef ListItemType StackItemType; typedef List Stack; /* * Function: CreateStack * Usage: L = CreateStack(); * ------------------------- * This function creates a new stack instance. */ Stack CreateStack(void); /* * Function: DestroyStack * Usage: DestroyStack(Stack S); * ------------------------- * This function frees memory allocated for a stack instance. */ void DestroyStack(Stack S); /* * Function: EmptyStack * Usage: b = EmptyStack(Stack S); * ------------------------- * This function returns true if S is empty and * false if S contains at least one item. */ bool EmptyStack(Stack S); /* * Function: StackSize * Usage: s = StackSize(Stack S); * ------------------------- * This function returns the number of items that are * currently on the stack.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: */ int StackSize(Stack S); /* * Function: FullStack * Usage: b = FullStack(Stack S); * -------------------------* This function returns true if the stack if full; * otherwise, false. */ bool FullStack(Stack S); /* * Function: push * Usage: b = push(StackItemType newItem,Stack S); * -------------------------* This function pushes an item onto the stack. If a push is * successful, newItem is at the top of S, and b is true; * otherwise b is false. * Note: push fails when the stack is full */ bool push(StackItemType newItem, Stack S); /* * Function: pop * Usage: StackItemType = pop(Stack S); * -------------------------* This function removes an item from the top of S if * it is non-empty. */ StackItemType pop(Stack S); /* * Function: getStackTop * Usage: dataItem = getStackTop(Stack S); * -------------------------* This function retrieves the item at the top of a * non-empty stack. */ StackItemType getStackTop(Stack S); #endif /* End of interface file. */...
View Full Document

This note was uploaded on 01/17/2012 for the course CSC 1254 taught by Professor Blanks,l during the Fall '08 term at LSU.

Page1 / 2

stack - */ int StackSize(Stack S); /* * Function: FullStack...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online