βββββββ βββ ββββββββ ββββββ βββββββ ββββ ββββββββββ βββ βββββββ
ββββββββ βββ βββββββββββββββββββββββββββββ βββββββββββ βββββββββββ
βββ βββ ββββββ ββββββββββββββββββββββ ββββββββββββ ββββββ ββββ
βββ βββ ββββββ ββββββββββββββββββββββββββββββββββββββββββ βββ
ββββββββ βββββββββββββββββββ ββββββ ββββββ ββββββββββββ βββββββββββββββ
βββββββ βββββββββββββββββββ ββββββ ββββββ βββββββββββ βββββ βββββββ
A hands-on C programming library built for absolute beginners.
Learn C from hello world to structs β runnable examples, auto-generated preview images, zero config.
macOS Β· Linux Β· Windows (WSL/MSYS2)
git clone https://github.com/chamaththiwanka/c-learning-library.git
cd c-learning-library
chmod +x setup.sh && ./setup.sh # checks gcc, make & optional tools
make run-all # runs every example in orderRun a single example:
make run TOPIC=01_hello_world/hello_world| Command | What it does |
|---|---|
make all |
Build everything into bin/ |
make run TOPIC=... |
Build & run one example |
make run-all |
Tour all examples in order |
make preview |
Generate preview_*.png (code + output) |
make clean |
Delete bin/ |
| OS | Install |
|---|---|
| macOS | xcode-select --install |
| Debian / Ubuntu | sudo apt install build-essential |
| Fedora | sudo dnf groupinstall "Development Tools" |
| Windows | WSL or MSYS2 |
Optional: silicon for syntax-highlighted code images.
make previewauto-createsscripts/.venv/with Pillow if needed.
| # | Topic | What you'll learn |
|---|---|---|
| 01 | Hello World & Variables | printf, data types, your first program |
| 02 | Operators | Arithmetic, relational, logical |
| 03 | Control Flow | if/else, switch, nested conditions |
| 04 | Loops | for, while, do/while, break/continue, goto |
| 05 | Functions | Declaration, parameters, return values, recursion |
| 06 | Arrays & Strings | 1-D / 2-D arrays, string functions |
| 07 | Pointers | Addresses, dereferencing, pointer arithmetic |
| 08 | Structs | Defining structs, arrays of structs |
π― What's next? This repo stops at structs. Good next steps: file I/O (
fopen), dynamic memory (malloc/free), linked lists.
make preview generates one image per example β source code + program output β under topics/<chapter>/previews/.
![]() |
![]() |
![]() |
01 β hello_world |
04 β for_loop |
07 β pointer_basics |
Every .c file gets a matching preview_*.png.
- Copy the comment header from any existing
.cfile. - Save as
topics/<chapter>/your_name.c. make all && make run TOPIC=<chapter>/your_name- (Optional)
make previewto generate its image.
topics/01_hello_world/ β¦ 08_structs/ β .c files + previews/
scripts/ β run_all, preview helpers
bin/ β compiled binaries (git-ignored)
setup.sh Β· Makefile Β· README.md
Chamath Thiwanka BICT (Hons), University of Sri Jayewardenepura
β If this helped you start your C journey, consider giving it a star!


