C: From Source to Systems
Pointers, memory and the machine underneath every other language.
C is small enough to learn in a weekend and deep enough to spend a career on. The language has about thirty keywords and no garbage collector, no exceptions, no classes and no strings - just bytes, addresses and the arithmetic that connects them. That minimalism is why it is still the language of operating systems, databases, embedded firmware and the runtime of almost every other language you use. Python is written in C. So is Linux, SQLite, Redis, and the interpreter running your JavaScript.
Overview
This course is five phases. It starts with the compiler and the four stages a source file passes through, moves through control flow and functions, and then spends a full phase on pointers because that is where C is either understood or not. The fourth phase is memory - the heap, structs, alignment and bit manipulation - and the fifth is the systems work the language exists for: files, multi-file projects, errors, and building linked lists, stacks, queues and hash tables from nothing but `malloc` and a pointer. Every lesson is free to read in full.
Introduction
You need a compiler and a terminal. GCC on Linux, Clang on macOS through the Xcode command-line tools, and on Windows either WSL, MinGW-w64 or MSVC - the first phase covers all four. An editor with no C support will do; this course uses the command line rather than an IDE, because understanding what `gcc -Wall -Wextra -g main.c -o main` does is part of understanding C.
A warning worth giving early: C will let you do things that are wrong. It will compile a program that reads memory it does not own and run it until it does not. Learning to use the compiler's warnings, and the sanitisers in phase four, is not an optional extra here - it is the difference between learning C and learning to produce programs that happen to work.
What you will be able to do
- Compile, link and debug a C program from the command line, and say what each stage did
- Choose types deliberately, and know what each one costs in bytes and in range
- Read and write pointer code, including pointer arithmetic and function pointers
- Explain what an array actually is, and why it is not a pointer
- Manage heap memory by hand without leaking it or freeing it twice
- Design structs with an eye on padding, and manipulate bits directly
- Read and write both text and binary files, with random access
- Split a project across headers and source files, and build it with a Makefile
- Implement linked lists, stacks, queues and hash tables from first principles
- Recognise undefined behaviour before the compiler turns it into something surprising
What each level covers
5 levels · 19 lessons
-
Phase 1 - Foundations and Core Syntax
The compiler, the types, the input and output, and the operators - the parts of C you can see.
4 lessons 11 min of reading
Start with Environment and Compilation → -
Phase 2 - Control Flow and Modularity
Branching, looping, and splitting a program into functions that can be reasoned about one at a time.
4 lessons 8 min of reading
Start with Conditional Branching → -
Phase 3 - Arrays, Strings and Pointers
The phase where C is either understood or not. Addresses, and the three things that are secretly addresses.
4 lessons 12 min of reading
Start with Arrays → -
Phase 4 - Memory Management and Custom Types
The heap, the structs you lay out on it, and the bits inside them.
3 lessons 7 min of reading
Start with Dynamic Memory Allocation → -
Phase 5 - Files, Projects and Systems Programming
Reading and writing the disk, splitting a project across files, and building the data structures from nothing.
4 lessons 12 min of reading
Start with File Handling →
Guides and articles
Longer reading about this subject, written alongside the course.
-
Undefined behaviour is not a crash. It is a promise you made to the compiler
Most C programmers learn undefined behaviour as a list of things that might crash. It is the opposite: a set of facts the compiler is entitled to assume are true, and it optimises on them. That is why a null check can vanish from your binary.
· 9 min read
Before you start
- A C compiler - GCC or Clang
- A terminal
- A text editor
- Valgrind or the address sanitiser, from phase four onwards
- No prior C
Common questions
- What does the C: From Source to Systems course cover?
- It is 5 levels and 19 lessons: Phase 1 - Foundations and Core Syntax; Phase 2 - Control Flow and Modularity; Phase 3 - Arrays, Strings and Pointers; Phase 4 - Memory Management and Custom Types; Phase 5 - Files, Projects and Systems Programming. Each level ends with a quiz, and the last one is an exam over the whole course.
- How long does it take?
- About 50 minutes of reading and exercises - roughly 0.8 hours. It is self-paced with no cohort and no start date, so you can leave and come back and the site remembers where you were.
- What do I need to know first?
- A C compiler - GCC or Clang. A terminal. A text editor. Valgrind or the address sanitiser, from phase four onwards. No prior C.
- Is it free?
- Yes. Every lesson, example and quiz in this course is free to read, and you do not need an account to read them. Signing in only adds progress tracking and quiz results.
- What will I be able to do afterwards?
- Compile, link and debug a C program from the command line, and say what each stage did. Choose types deliberately, and know what each one costs in bytes and in range. Read and write pointer code, including pointer arithmetic and function pointers. Explain what an array actually is, and why it is not a pointer. Manage heap memory by hand without leaking it or freeing it twice. Design structs with an eye on padding, and manipulate bits directly. Read and write both text and binary files, with random access. Split a project across headers and source files, and build it with a Makefile. Implement linked lists, stacks, queues and hash tables from first principles. Recognise undefined behaviour before the compiler turns it into something surprising.