Skip to content

Free · Open source · No sign-up

Learn C from the ground up.

38 small, runnable programs take you from your first printf to pointers, memory, sockets, threads and a terminal game you build yourself.

Lesson 1: Hello, World!
$ cc -Wall -Wextra -std=c17 -o 1_hello_world 1_hello_world.c
$ ./1_hello_world
Hello, World!
$ ▌

How it works

  1. Read the program

    Every lesson is one small C file. The explanation lives in its comments, right next to the code it explains.

  2. Compile it yourself

    Each page gives you the exact commands for macOS, Linux and Windows (WSL). No IDE, no magic.

  3. Run it and change it

    See what it does, then break it on purpose. The fastest way to learn C is to argue with a compiler.

The path

Six parts, each building on the last. Earlier lessons only use what you have already learned.

  1. Part 1

    The Beginner Path — Core Concepts

    Core language fundamentals from Hello World through strings.

    1. 1 Hello, World!
    2. 2 Variables and Data Types
    3. 3 User Input
    4. 4 Basic Operators
    5. 5 Conditional Statements
    6. 6 Loops
    7. 7 Functions
    8. 8 Arrays
    9. 9 Strings
  2. Part 2

    The Intermediate Path — Deeper into C

    Pointers, structs, dynamic memory, file I/O, and command-line arguments.

    1. 10 Pointers
    2. 11 Pointers and Arrays
    3. 12 Structs
    4. 13 Dynamic Memory Allocation
    5. 14 File I/O
    6. 15 Command-Line Arguments
  3. Part 3

    The Advanced Path — Towards Mastery

    Projects and deeper topics including function pointers, recursion, linked lists, bit manipulation, and a line-based text editor.

    1. 16 Simple Calculator
    2. 17 Student Record System
    3. 18 Function Pointers
    4. 19 Recursion
    5. 20 Linked Lists
    6. 21 Bit Manipulation
    7. 22 Preprocessor Directives
    8. 23 Unions and Enums
    9. 24 Static and Extern Variables
    10. 25 Simple Text Editor
  4. Part 4

    The Expert Path — Systems and Concurrency

    Systems programming with sockets, process management, hash tables, and multithreading.

    1. 26 Simple Socket Server and Client
    2. 27 Build Your Own grep
    3. 28 Hash Table Implementation
    4. 29 Tiny Shell
    5. 30 Multithreaded File Analyzer
  5. Part 5

    Expert Systems and Application Development

    Multi-file projects, external libraries, terminal UI with ncurses, data parsing, and a capstone text adventure.

    1. 31 Makefiles for Multi-File Projects
    2. 32 Linking External Libraries
    3. 33 Advanced Terminal UI
    4. 34 Parsing Data Files
    5. 35 Capstone: Text Adventure
  6. Part 6

    The Toolsmith Path — Debugging, UB and Testing

    Debugging with gdb and lldb, undefined behavior and the sanitizers, and testing in C.

    1. 36 Debugging
    2. 37 Undefined Behavior
    3. 38 Testing in C

All you need is a terminal.

Install a compiler once with the setup guide, then work through the lessons at your own pace. Prefer to read offline? The course is also a book, and every file is on GitHub.

Start lesson 1

Search the course

Type at least two letters. Press / anywhere to search.

↑ ↓ to choose, Enter to open. On a lesson, j and k go to the next and previous lesson.