Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef STACK_STACK_H
- #define STACK_STACK_H
- #define StackEntry int
- #include <iostream>
- typedef struct StackNode
- {
- StackEntry entry;
- StackNode* next;
- }StackNode;
- typedef struct stack
- {
- StackNode* top;
- int size;
- }Stack;
- //pre-conditions: stack is initialized and not full(the user must check that the stack is not full)
- void push(StackEntry pe,Stack *ps);
- //post-conditions: the element is stored on top and not changed
- //pre-conditions: stack is initialized and not empty(the user must check that the stack is not empty)
- void pop(StackEntry *pe,Stack *ps);
- //post-conditions: the top value is cleared from the stack and its value is returned
- void CreateStack(Stack *ps);
- int StackFull(Stack *ps);
- int StackEmpty(Stack *ps);
- void Traverse(Stack *ps,void(*pf)(StackEntry));
- void ClearStack(Stack *ps);
- int StackSize(Stack *ps);
- void StackTop(StackEntry *pe,Stack *ps);
- #endif //STACK_STACK_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement