Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include "stack.h"
- extern Stack theStack;
- int main()
- {
- StackError_t res;
- uint8_t value;
- res = init();
- if (res == StackError_t::STACK_NO_ERROR)
- printf("Stack initialized successfully.\n");
- else
- return -1;
- if (isEmpty())
- printf("The stack is empty.\n");
- else
- printf("The stack is not empty.\n");
- res = push(12);
- if (res == StackError_t::STACK_NO_ERROR)
- printf("Value pushed successfully.\n");
- res = pop(&value);
- if (res == StackError_t::STACK_NO_ERROR)
- printf("Value popped successfully.\n");
- res = peek(&value);
- if (res == StackError_t::STACK_VALUE_NOT_FOUND)
- printf("%u not found in stack.\n", value);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement