Learn
Learn C
The language the kernel is written in. From zero.
Start from zero and finish able to write, compile, debug, and reason about a real multi-function C program. Module 1 builds the foundations: the toolchain, types and sizes, control flow, functions and the stack, and pointers. Module 2 puts C to work: strings, file I/O, structs and the heap, gdb, strace, and signals. Every lesson proves its idea on a live Linux VM, and the track ends with a from-scratch capstone graded by a real compiler, an input matrix, and valgrind. Prerequisite: Linux Foundations.
15 hands-on labs across 2 modules, about 9 hours of work. Every lab runs on a real virtual machine in your browser, and checks your work on the machine itself.
Modules and labs
What C is and why it exists, the gcc toolchain, types and sizes, control flow, functions and the stack, and a first working model of pointers and memory. Each lesson compiles and runs real code on a live VM.
- What C is - What a compiler is, from zero. An interpreter like bash re-translates a script at every run; a compiler like gcc translates C source into a binary once, and the
- Hello, machine - Write, compile, and run your first C programs. main is the entry point, printf speaks to the screen, gcc -Wall builds the binary, and ./hello runs it. Receive c
- Types and sizes - Every C variable is a box with a fixed size: on this 64-bit machine char is 1 byte, short 2, int 4, long 8, and a pointer 8, all measurable with sizeof (char is
- Control flow - Learn the tools that steer a C program: if/else decisions, for and while loops, switch dispatch, and the && and combiners. Predict branch outcomes before you co
- Functions and the stack - Package code into functions: definition vs call, parameters vs arguments, the return value, and scope. C passes copies, so changing a parameter never changes th
- Pointers and memory - A variable lives at a numbered spot in memory called an address. The & operator takes that address, follows it, and writing through a pointer changes the origin
- Lab: Max of Three - Read 3 integers from argv, print and return the max as the exit code.
C at work: strings and the standard library, file I/O, structs and the heap, debugging with gdb, tracing with strace, and signal handling. Ends with a CSV parser lab and the track capstone.
- Strings and stdlib - A C string is a char array ending in a NUL terminator, and every string.h function trusts that stop mark. Measure the same char[6] two ways (strlen=4 vs sizeof=
- File I/O - Open, read, and close files from C with fopen, fgets, and fclose, and never trust an open you did not check. When fopen returns NULL, read errno through strerro
- struct and the heap - Group related values into a struct, a shaped box with named fields, and give it a life longer than one function by renting memory on the heap with malloc and re
- Debugging with gdb - Compile with -g and drive a real gdb session on a real crash: run, backtrace, break, info locals, print, continue. Read a SIGSEGV backtrace bottom up, find the
- Tracing with strace - The syscalls behind printf and fopen. Put strace on a working file reader and watch fopen become openat, the fgetc loop become one buffered read, and printf bec
- Signals - Signals are the kernel's asynchronous messages to a process: SIGINT from Ctrl-C, SIGTERM from kill, SIGKILL from kill -9. Watch the default action destroy a pro
- Lab: CSV Parser - A CSV parser using struct and malloc, freed clean under valgrind.
- Learn C Capstone - Write a 4-function C utility from scratch to a spec, graded by compiler warnings, an input matrix, and valgrind.
Frequently asked questions
How many labs are in Learn C?
Learn C has 15 hands-on labs, roughly 9 hours of guided work, spread across 2 modules.
Do I need my own server or hardware to do the Learn C labs?
No. Every lab boots a real virtual machine in your browser, with a real Linux shell. There is nothing to install, and nothing on your own machine to break.
What level is Learn C?
Labs in this track are rated beginner, intermediate. The track starts from the beginning, so no prior experience is assumed.