Skip to content
Codescope

Track 01 · C

The C track

Pointers, the stack, the heap, and what the bytes actually look like.

44 concepts mapped · 13 interactive now · 100 steps · free, no login

BeginnerStart here — no prior programming experience required.

01Foundations

4 of 5 live

What a variable is, and what the machine sees instead.

  1. 01

    Variables & memory addresses

    A variable is a name you gave to a box the machine only knows by number.

    intro7 min8 steps
    0%
  2. 02

    Data types & sizes

    Why int is 4 bytes, what sizeof really asks, and integer overflow.

    intro8 min7 steps
    0%
  3. 03

    Operators & precedence

    upcoming

    Evaluation order, integer division, and the traps in ++i vs i++.

  4. 04

    Control flow

    if, loops and switch as jumps — including fallthrough and off-by-one.

    intro8 min7 steps
    0%
  5. 05

    Functions & scope

    Parameters are copies; locals, globals and static all live differently.

    intro9 min7 steps
    0%
IntermediateBuild on the fundamentals with the mechanics working developers meet daily.

02Pointers

3 of 6 live

The idea the whole language is built on.

  1. 06

    Pointers 101

    A pointer is an ordinary variable. The value it stores happens to be an address.

    intro9 min8 steps
    0%
  2. 07

    Pointer arithmetic

    p + 1 does not add 1. It adds one element — and the type decides how big that is.

    core10 min7 steps
    0%
  3. 08

    Arrays vs pointers

    They behave alike in almost every expression — and then sizeof tells the truth.

    core9 min7 steps
    0%
  4. 09

    Pointers to pointers

    upcoming

    Why char **argv works, and how to modify a caller's pointer.

  5. 10

    const & pointers

    upcoming

    Reading the declaration right to left: const pointer vs pointer to const.

  6. 11

    void pointers & generic code

    upcoming

    Type erasure in C, and how qsort takes any array.

AdvancedDeep internals, specialist tooling, and the topics you reach for at scale.

03Memory & lifetime

3 of 5 live

Where things live, and for how long.

  1. 12

    The function call stack

    Every call pushes a frame. Every return pops one. That is the entire mechanism.

    core8 min8 steps
    0%
  2. 13

    Recursion on the stack

    Nothing special happens. A function calling itself gets a new frame, like any other call.

    core9 min9 steps
    0%
  3. 14

    Dynamic memory: malloc & free

    The heap gives you memory that outlives the frame that asked for it — and never cleans up after you.

    deep11 min9 steps
    0%
  4. 15

    A program's memory layout

    upcoming

    Text, data, bss, heap and stack — and which way each one grows.

  5. 16

    Leaks, overflows & sanitizers

    upcoming

    The five classic memory bugs and the tools that find them.

04Composite data

1 of 5 live

Building types out of other types.

  1. 17

    Structs & memory layout

    Your struct is bigger than the sum of its fields, and the field order decides by how much.

    deep10 min7 steps
    0%
  2. 18

    Unions & enums

    upcoming

    One block of memory read several ways, and named integer constants.

  3. 19

    typedef & opaque types

    upcoming

    Naming types, and hiding a struct's contents behind a header.

  4. 20

    Linked lists

    upcoming

    Nodes scattered across the heap, stitched together by pointers.

  5. 21

    2D arrays & matrices

    upcoming

    Row-major layout, and why arr[i][j] is one address calculation.

IntermediateBuild on the fundamentals with the mechanics working developers meet daily.

05Strings & I/O

1 of 4 live

Text is bytes, and files are streams.

  1. 22

    Strings in memory

    C has no string type. It has bytes, and an agreement about where they stop.

    deep11 min7 steps
    0%
  2. 23

    The string library

    upcoming

    strlen, strcpy, strcmp and the bounded versions you should prefer.

  3. 24

    printf & scanf

    upcoming

    Format specifiers, and why scanf is where input bugs come from.

  4. 25

    File I/O

    upcoming

    fopen, buffering, EOF, and why your output appears late.

AdvancedDeep internals, specialist tooling, and the topics you reach for at scale.

06Systems & tooling

1 of 5 live

How C becomes a program.

  1. 26

    Bitwise operations

    Eight switches in a byte. These operators flip them in parallel.

    core10 min9 steps
    0%
  2. 27

    The preprocessor

    upcoming

    Textual substitution before compilation, and why macros need parentheses.

  3. 28

    Function pointers

    upcoming

    Storing code addresses — callbacks, dispatch tables and qsort.

  4. 29

    Compilation & linking

    upcoming

    Preprocess, compile, assemble, link — and where each error comes from.

  5. 30

    Undefined behaviour

    upcoming

    Why it works on your machine, and why the optimiser deletes your check.

07Concurrency & threads

0 of 5 live

More than one thread of execution, and the coordination they need.

  1. 31

    Threads & mutexes

    upcoming12 min

    Two threads, one shared variable, and the mutex that prevents chaos.

    • Create threads with pthread_create and join them
    • Use pthread_mutex to protect shared state
    • Recognise the classic race condition and why print interleaves
  2. 32

    Atomic operations

    upcoming11 min

    Hardware-supported reads and writes that no other thread can split.

    • Use _Atomic types and atomic_load / atomic_store
    • Compare-and-swap (CAS) as the building block of lock-free code
    • See why atomic_int++ is one instruction and int++ is three
  3. 33

    Memory ordering & happens-before

    upcoming13 min

    The CPU may reorder your writes; a memory barrier is how you say "don't".

    • Understand relaxed, acquire, release, and sequentially-consistent orderings
    • Read a happens-before diagram between two threads
    • Diagnose a bug that only appears on ARM and not on x86
  4. 34

    Lock-free data structures

    upcoming14 min

    Progress guaranteed without any thread ever sleeping — and the ABA problem.

    • Implement a lock-free stack with CAS
    • Recognise the ABA problem and how tagged pointers dodge it
    • Compare lock-free versus mutex throughput as contention rises
  5. 35

    Condition variables

    upcoming11 min

    How a thread goes to sleep waiting for a condition, and wakes exactly once.

    • Pair a condition variable with its mutex
    • Wait in a loop and signal after mutating shared state
    • Build a bounded producer/consumer queue with pthread_cond

08Systems programming

0 of 5 live

Talking to the kernel — files, processes, and the boundary between them.

  1. 36

    System calls & the kernel boundary

    upcoming10 min

    How a library function like read() actually leaves userspace.

    • Trace a printf call down to the write syscall
    • Understand the userspace/kernelspace privilege boundary
    • Use strace to see the syscalls your program actually makes
  2. 37

    Signals & async-safe code

    upcoming12 min

    Handlers that fire in the middle of any line, and the rules they must follow.

    • Install a signal handler with sigaction
    • List which functions are async-signal-safe and why
    • Handle SIGCHLD, SIGINT, and SIGSEGV correctly
  3. 38

    mmap & memory-mapped files

    upcoming12 min

    Read a 10 GB file as if it were an array — the kernel pages it in for you.

    • Map a file into your address space with mmap
    • Understand copy-on-write private mappings
    • Share memory between processes via MAP_SHARED
  4. 39

    select, poll & epoll

    upcoming13 min

    Watching a thousand sockets in one thread without spinning.

    • Write an echo server with select, poll, then epoll
    • See why select degrades linearly with the fd count
    • Use edge-triggered vs level-triggered epoll correctly
  5. 40

    fork & exec in C

    upcoming11 min

    Duplicate the current process, then have the child turn into a different program.

    • Call fork and act differently in parent vs child
    • Replace the child image with execvp
    • Reap children with waitpid and avoid zombies

09Performance & hardware

0 of 4 live

Why the same algorithm can run 10× faster with the right data layout.

  1. 41

    Cache lines & locality

    upcoming12 min

    The CPU reads 64 bytes at a time; laying data out to match is free speed.

    • Predict which of two loops is faster from access patterns alone
    • Diagnose false sharing between two threads on the same cache line
    • Structure-of-arrays vs array-of-structures trade-offs
  2. 42

    Branch prediction & mispredicts

    upcoming10 min

    The CPU guesses which way an if will go; a wrong guess costs ~15 cycles.

    • Explain the famous sorted-vs-unsorted array performance gap
    • Use __builtin_expect (likely/unlikely) sparingly and correctly
    • Replace unpredictable branches with branchless arithmetic
  3. 43

    Alignment & SIMD intrinsics

    upcoming14 min

    Process 4 or 8 elements per instruction with hand-rolled vector code.

    • Use aligned_alloc and understand why unaligned SSE crashes
    • Vectorise a hot loop with _mm_add_ps intrinsics
    • Read the assembly that the auto-vectoriser did (or didn't) produce
  4. 44

    Profile-guided optimisation

    upcoming9 min

    Run the program, feed the profile back to the compiler, get a 10% speedup.

    • Build with -fprofile-generate, run a representative workload, rebuild with -fprofile-use
    • Understand what the compiler learns (hot paths, likely branches, inlining)
    • Know when PGO helps and when it doesn't

The full syllabus is listed above in teaching order. Concepts marked upcoming are mapped but not yet built as visualizations. Progress is kept in this browser only.