Learn › Learn C
C Foundations
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.
Labs in this module
- 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
- 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 ./hell
- 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
- 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 ou
- 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 parame
- 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 pointe
- Lab: Max of Three - Read 3 integers from argv, print and return the max as the exit code.