The course
Five parts, taken in order. Each lesson is one small C program you read, compile and run; the comments in the code are the lesson.
Want every file at once? Download the whole course (.zip).
Part 1
The Beginner Path — Core Concepts
Core language fundamentals from Hello World through strings.
- Lesson 1 Hello, World! Welcome to your first lesson in C! The journey to mastering C is challenging but incredibly rewarding. It all begins with this single step.
- Lesson 2 Variables and Data Types In the last lesson, we printed a fixed message. To write useful programs, we need a way to store and manipulate data that can change. This is where…
- Lesson 3 User Input So far, our programs have been one-way streets: they run and print things without any input from the outside world. To build truly useful tools, we…
- Lesson 4 Basic Operators In programming, an OPERATOR is a special symbol that performs an operation on one or more values or variables (called OPERANDS). For example, in 5 +…
- Lesson 5 Conditional Statements Our programs so far have been linear; they execute every line of code from top to bottom in the same order every time. To create powerful and…
- Lesson 6 Loops Imagine you needed to print "Hello!" five times. You could write:
- Lesson 7 Functions As programs grow larger, putting all the code inside the main function becomes messy, hard to read, and difficult to maintain. If you have a task…
- Lesson 8 Arrays So far, we have only used variables that can hold one value at a time. For example, int score = 100;. But what if you need to store the scores for an…
- Lesson 9 Strings Up to this point, we've only seen string "literals" (text in double quotes) used directly in printf. We haven't stored or manipulated them.
Part 2
The Intermediate Path — Deeper into C
Pointers, structs, dynamic memory, file I/O, and command-line arguments.
- Lesson 10 Pointers Welcome to Part 2 of your C journey! You've mastered the fundamentals, and now we're diving deeper. This lesson introduces POINTERS, arguably the…
- Lesson 11 Pointers and Arrays In the previous lesson, you learned what a POINTER is: a variable that stores a memory address. Now, we will explore one of the most important…
- Lesson 12 Structs So far, our variables have held a single piece of data (like an int or a double), and our arrays have held multiple pieces of the SAME type of data.
- Lesson 13 Dynamic Memory Allocation Until now, the size of all our variables and arrays had to be known when we wrote the program (at COMPILE-TIME). For example, int numbers[10]…
- Lesson 14 File I/O All our programs so far have had a temporary existence. When the program ends, any data it was holding in variables, arrays, or structs is lost…
- Lesson 15 Command-Line Arguments You've already been using command-line arguments without even realizing it! When you compile a program like this:
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.
- Lesson 16 Simple Calculator Welcome to Part 3! It's time to start building bigger things. This lesson is our first real PROJECT: a simple calculator that works from the command…
- Lesson 17 Student Record System This project is where everything comes together. We will build a complete application that can:
- Lesson 18 Function Pointers You have mastered pointers to DATA (like int* or struct Student*), which store the memory address of a variable.
- Lesson 19 Recursion So far, when you've needed to repeat a task, you've used a loop (for or while). Today, we're going to learn a powerful and elegant alternative…
- Lesson 20 Linked Lists So far, our primary way of storing a collection of items has been the ARRAY. Arrays are great, but they have one major limitation: they have a fixed…
- Lesson 21 Bit Manipulation C is a language that operates very close to the hardware. All data in your computer--integers, characters, etc.--is ultimately stored as a sequence…
- Lesson 22 Preprocessor Directives Before your C code is ever seen by the actual compiler, it goes through a first pass by a program called the C PREPROCESSOR. The preprocessor's job…
- Lesson 23 Unions and Enums Today we're looking at two special kinds of data types: enum and union. While they look a bit like structs, they solve very different problems.
- Lesson 24 Static and Extern Variables As programs grow, we need more control over our variables and functions. We need to answer two key questions:
- Lesson 25 Simple Text Editor Welcome to your Part 3 capstone project! This is where we put everything together to build a substantial application: a command-line text editor.
Part 4
The Expert Path — Systems and Concurrency
Systems programming with sockets, process management, hash tables, and multithreading.
- Lesson 26 Simple Socket Server and Client Welcome to the world of network programming! In this lesson, we will build a complete, working client-server application in two programs: a CLIENT…
- POSIX
- Lesson 27 Build Your Own grep This lesson is a project: your own version of a classic Unix tool.
- Lesson 28 Hash Table Implementation This lesson is a project: a data structure you build from scratch.
- Lesson 29 Tiny Shell This lesson is a project: a working command-line shell.
- POSIX
- Lesson 30 Multithreaded File Analyzer This lesson is a project: putting every core of your CPU to work.
- POSIX
- threads
Part 5
Expert Systems and Application Development
Multi-file projects, external libraries, terminal UI with ncurses, data parsing, and a capstone text adventure.
- Lesson 31 Makefiles for Multi-File Projects Welcome to a pivotal moment in your C journey. Until now, we have worked with single source files. While great for learning, real-world applications…
- make
- Lesson 32 Linking External Libraries In our last lesson, we learned how to build a project from multiple source files that WE wrote. But what if we want to use code written by someone…
- libm
- Lesson 33 Advanced Terminal UI So far, our programs have been linear: we printf some text, scanf some input, and the text scrolls up and away forever. It's functional, but not very…
- ncurses
- Lesson 34 Parsing Data Files So far, our programs have either been non-persistent or have saved data in a simple, unstructured way. Real-world applications, however, almost…
- Lesson 35 Capstone: Text Adventure Welcome to the final project. This is it.
- ncurses
Part 6
The Toolsmith Path — Debugging, UB and Testing
Debugging with gdb and lldb, undefined behavior and the sanitizers, and testing in C.
- Lesson 36 Debugging Welcome to Part 6, the Toolsmith Path. You can now write real C programs. This part is about the tools that keep them correct: debuggers, sanitizers…
- Lesson 37 Undefined Behavior The C standard describes what every valid program does. For some operations it says the opposite: if a program does this, the standard places NO…
- Lesson 38 Testing in C Every lesson in this course is checked automatically: a script compiles it, feeds it input and compares what it prints with what it should print…