crunch-c

learn C memory management without segfaults

Every memory error is caught and explained. No segfaults. No undefined behavior. Just C's behavior, narrated.

▶ Start the course

What you'll learn

Loading modules…

How it works

In C, memory mistakes cause segfaults, crashes and security vulnerabilities. Here the same mistakes are caught and named:

quicksand at line 5, column 9
    |
  5 | val = p.peek(i32)
    |         ^
this ground was scorched at line 4 (garrisoned at line 1)

You learn what C does, and why it is dangerous, without the danger. The lessons run in your browser — the real interpreter, compiled to WebAssembly, with nothing to install.

Run it locally

The course is a git repository. To work through it in your own editor:

pip install magmascript
git clone https://github.com/magmacrunch-media/crunch-c.git
cd crunch-c
magmascript 01-types/01-widths.mgs

Every exercise has a worked answer under solutions/. The ones that teach a fault end by triggering it, so they exit non-zero on purpose.