Skip to content

Queue (and stack) implementations in C for learning basic data-structure operations. The queue uses a fixed-size array and menu-driven CLI to enqueue, dequeue, and display elements with overflow/underflow checks and input validation. The stack example shows LIFO push/pop/peek fundamentals with similar safeguards.

Notifications You must be signed in to change notification settings

bashu-dev/Queue_implementation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Queue and Stack Implementations in C

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.

Files

  • 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.

Features

  • Robust input handling to prevent crashes on invalid entries.
  • Clear overflow/underflow reporting.
  • Small, self-contained C programs with no external dependencies.

Requirements

  • Any C99-compatible compiler (e.g., gcc).

Build

gcc queue_implementation.c -o queue
gcc stack.c -o stack

Run

./queue   # queue menu
./stack   # stack menu

Usage

Queue:

  • 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.

Customization Ideas

  • Adjust MAX_SIZE to fit your tests.
  • Extend the queue to a circular queue for better space reuse.
  • Add dynamic resizing or more menu options (search, clear, etc.).

License

MIT

About

Queue (and stack) implementations in C for learning basic data-structure operations. The queue uses a fixed-size array and menu-driven CLI to enqueue, dequeue, and display elements with overflow/underflow checks and input validation. The stack example shows LIFO push/pop/peek fundamentals with similar safeguards.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages