/** A structure type representing a node in the linked list. * Each node contains a pointer to the next node in the list, and a * character field */ typedef struct node { // Student must fill in the node structure } Node; /** A structure representing a stack based around a linked list. */ typedef struct { Node *head; //!< A pointer to the head item in the linked list. int count; //!< How many nodes have been added to the list? int size; //!< How many nodes may be added to the list? } Stack; /** Create a new Stack and return a pointer to it. * * \param size How many items can the new stack hold? */ Stack *create_stack(int size); /** Release the memory associated with the specified stack. * * \param release A pointer to the Stack to free. */ void free_stack(Stack *release); /** Push a character onto the stack. This adds the specified character to the * top of the stack. If the push fails (because memory could not be allocated * for the new stack item), this will exit the program with an error. * * \param stack A pointer to the stack to push the character onto. * \param c The character to push onto the top of the stack. */ void push(Stack *stack, char c); /** Pop a character off the stack, and return the chracter. This removes the * top item from the stack, and returns the character that was stored there. * * \param stack A pointer to the stack to pop an item off. * \return The character that was at the top of the stack, or -1 if the stack * is empty. */ char pop(Stack *stack); /** Determine whether the stack is empty. * * \param stack A pointer to the stack to check for items. * \return true (non-zero) if the stack is empty, false (zero) if it contains * one or more entries. */ int isempty(Stack *stack); /** Check whether the stack is full. This determines whether it is possible * to create a new stack item, and if it is this returns false. If a new * item can not be allocated, this returns true. * * \param stack A pointer to the stack to check the capacity of. * @return true (non-zero) if the stack is full, false (zero) if it is not. */ int isfull(Stack *stack);