Skip to content

Cortana-Devs/C-Learning-Library

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

C Learning Library

   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—     β–ˆβ–ˆβ•—     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•—   β–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ•—   β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— 
  β–ˆβ–ˆβ•”β•β•β•β•β•     β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β• 
  β–ˆβ–ˆβ•‘          β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ–ˆβ•—
  β–ˆβ–ˆβ•‘          β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•”β•β•β•  β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘
  β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•
   β•šβ•β•β•β•β•β•     β•šβ•β•β•β•β•β•β•β•šβ•β•β•β•β•β•β•β•šβ•β•  β•šβ•β•β•šβ•β•  β•šβ•β•β•šβ•β•  β•šβ•β•β•β•β•šβ•β•β•šβ•β•  β•šβ•β•β•β• β•šβ•β•β•β•β•β• 

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)

License: MIT Language Beginner Friendly


⚑ Quick Start

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 order

Run 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/

πŸ–₯️ Prerequisites

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 preview auto-creates scripts/.venv/ with Pillow if needed.


πŸ“š Chapters

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


πŸ–ΌοΈ Previews

make preview generates one image per example β€” source code + program output β€” under topics/<chapter>/previews/.

hello_world for_loop pointer_basics
01 β€” hello_world 04 β€” for_loop 07 β€” pointer_basics

Every .c file gets a matching preview_*.png.


✏️ Add Your Own

  1. Copy the comment header from any existing .c file.
  2. Save as topics/<chapter>/your_name.c.
  3. make all && make run TOPIC=<chapter>/your_name
  4. (Optional) make preview to generate its image.

πŸ“ Layout

topics/01_hello_world/ … 08_structs/   ← .c files + previews/
scripts/                              ← run_all, preview helpers
bin/                                  ← compiled binaries (git-ignored)
setup.sh Β· Makefile Β· README.md

πŸ‘€ Author

Chamath Thiwanka BICT (Hons), University of Sri Jayewardenepura

GitHub


⭐ If this helped you start your C journey, consider giving it a star!

About

πŸ“˜ Learn C from zero β€” hello world to structs, with runnable examples & auto-generated previews. Works on macOS, Linux & Windows.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C 54.8%
  • Python 21.4%
  • Shell 21.0%
  • Makefile 2.8%