Examples

Browse every example in the repository, with its source code, command and recorded output where available.

The test corpus is the collection of programs used to check the compiler. On every commit, the tests build and run them in three configurations; examples that need an unavailable C library are skipped. Where a page shows recorded output below the command, the tests compare the program’s output with that text byte for byte.

Start with the first group, which introduces one idea at a time in reading order. These files are checked for compilation errors and formatting, but their output is not recorded or tested. The remaining groups make up the test corpus, with programs such as a JSON reader, a small language interpreter, a SQLite ledger and calculations using raylib.

Start here · Reading and processing text · Numbers and algorithms · Data structures · Files and the command line · C libraries · Threads · Games and simulations

Reading and processing text

Numbers and algorithms

Data structures

Files and the command line

C libraries

Threads

Games and simulations

Next: the language, one idea at a time, or the complete specification in one file to hand to a model. How to run an example.