Fixed-size queue and stack implementations for learning fundamental data-structure operations. Both programs provide a simple, menu-driven CLI with clear messages for overflow/underflow and input validation.
queue_implementation.c— array-based FIFO queue with enqueue, dequeue, display, and exit.stack.c— array-based LIFO stack with push, pop, peek, display, and exit.
- Robust input handling to prevent crashes on invalid entries.
- Clear overflow/underflow reporting.
- Small, self-contained C programs with no external dependencies.
- Any C99-compatible compiler (e.g.,
gcc).
gcc queue_implementation.c -o queue
gcc stack.c -o stack./queue # queue menu
./stack # stack menuQueue:
- Enqueue integers until full (MAX_SIZE).
- Dequeue from the front; empty queue is reported.
- Display shows the queue from front to rear.
Stack:
- Push integers until full.
- Pop/peek from the top; empty stack is reported.
- Display shows the stack top-down.
- Adjust
MAX_SIZEto fit your tests. - Extend the queue to a circular queue for better space reuse.
- Add dynamic resizing or more menu options (search, clear, etc.).
MIT