Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stack with Linked List

A simple C implementation of a stack using a linked list.

Files

  • main.c – demonstration program
  • Stack.c – stack operations
  • header.h – structure and function declarations

Build

Run the following command to compile the project:

gcc main.c Stack.c -o stack_program

Usage

Run the compiled executable:

./stack_program

Block Diagram

Below is a small block diagram showing how the project components interact and how the stack is represented internally (linked list of nodes).

graph LR
	main[main.c] --> api["Stack API<br/> (push / pop / peek)"]
	api --> stack["Stack (Linked List)"]
	stack --> node1["Node<br/>{data, next}"]
	node1 --> node2["Node<br/>{data, next}"]
	node2 --> null["NULL"]
Loading

And a simple ASCII view of the linked list (top is leftmost):

top -> [data | next] -> [data | next] -> NULL

About

Compact C stack implemented with a singly linked list. Includes push, pop, peek, and isEmpty functions plus an example main.c. Illustrates dynamic memory allocation, pointer-based node management, and simple error checks—useful for learning stack internals and small, portable C projects. (demo1)!

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages