C from zero
Learn to program from zero with C — the language underneath almost everything. You'll see exactly how code, memory, and the machine fit together, which makes every language after it easier. The whole course is free.
1Getting Started
What a program is, and your first one running.
2Variables & Data
Storing values, printing them, and reading them from the user.
- VariablesA named box that stores a value.
- Data Typesint, float, and char — whole numbers, decimals, and letters.
- How Big Is a Variable? (sizeof)Every type takes up a fixed amount of memory.
- Constants and KeywordsValues that never change, and words C reserves for itself.
- Printing with printfFormat codes and escape sequences like \n and \t.
- Taking Input with scanfReading numbers the user types.
3Operators
Doing math and combining values.
4Making Decisions
Running different code depending on a condition.
5Loops
Repeating code without writing it again.
6Functions
Naming a piece of code so you can reuse it.
7Pointers
Variables that store where other variables live. Direct access to memory — with great power comes great responsibility.
8Arrays
Many values of the same type, in a row.
9Strings
Working with text.
10Structures
Grouping related values into your own type.
11Working with Files
Saving data so it's still there next time.
12Dynamic Memory
Asking for memory while the program runs — and the responsibility that comes with it: everything you take, you give back.
13Going Further
The tools real C programs lean on — read-only promises, functions as values, the preprocessor, many files, arguments, and the standard maths and clock.
- Const CorrectnessPromising not to change what you only read.
- Function Pointers and CallbacksPassing "which function to call" as a value.
- The Preprocessor and Macros#include, #define, include guards, and #if.
- Multi-File Programs and HeadersSplitting a program into modules with .h and .c files.
- Command-Line Argumentsargc, argv, and reading words typed after the program's name.
- Math, Random Numbers, and Timemath.h, rand and srand, and the clock.
14Writing Robust Code
Handling failure on purpose, and finding bugs when they happen anyway.
15Building Data Structures
Putting structs, pointers, and the heap together to build containers of your own.
16C Reference
Look-it-up pages: every keyword, the operator precedence table, printf/scanf format codes, and the most-used functions of the standard headers — each with its signature, a gotcha, and a tiny example.
- Reference: KeywordsEvery C keyword, grouped by what it's for.
- Reference: Operators and PrecedenceAll the operators, highest precedence first, with the classic traps.
- Reference: Format Specifiersprintf and scanf codes, widths, precision, and flags.
- Reference: stdio.hprintf, scanf, fgets, files, and friends.
- Reference: stdlib.hMemory, conversions, random numbers, qsort, and exit.
- Reference: string.hLength, copying, comparing, searching, splitting, and raw memory.
- Reference: math.hRoots, powers, rounding, logs, and trigonometry.
- Reference: ctype.hTesting and converting single characters.
- Reference: time.hThe clock, the calendar, strftime, and timing code.