Stack of integers, public header file istack.h
# ifndef ISTACK_H
# define ISTACK_H
typedef struct istack *istack;
/*
* create a new empty stack of integers
* RETURN VALUE: NULL if allocation fails
*/
istack istack_new (void);
/*
* push an integer onto an existing istack
* RETURN VALUE: 0 upon success
* -1 upon failure (to allocate enough memory)
*/
int istack_push (istack, int);
/*
* Query the number of elements on a given istack.
* This number is the total number of istack_push operations performed
* minus the total number of istack_pop operations performed.
*/
int istack_height (istack);
/*
* pop the topmost integer from an istack;
* caveat:
* istack_pop (s)
* can only be called if
* istack_height (s) > 0
*/
int istack_pop (istack);
/* Free all memory associated with this stack. */
void istack_delete (istack);
# endif