A practical Zig 0.16.0 tutorial for C programmers.
Each chapter starts with a small C example, then shows the Zig version and the main differences.
- Zig 0.16.0
- A C compiler (
gccorclang) - Python 3.10+ for the optional snippet validator
- 01 Hello World
- 02 Variables and Types
- 03 Operators
- 04 Control Flow
- 05 Functions
- 06 Arrays
- 07 Structs
- 08 Enums
- 09 Unions
- 10 Strings
- 11 Slices
- 12 Optionals
- 13 Pointers
- 14 Memory
- 15 Errors
- 16 Defer
- 17 Testing
- 18 Comptime
- 19 Generics
- 20 Builtins
- 21 Anytype
- 22 Formatting
- 23 File I/O
- 24 Collections
- 25 Threads
- 26 FFI
- 27 Build System
- 28 Build Modes
- 29 Sorting and Searching
- 30 Hashing and Patterns
- 31 Project: CLI Tool
- 32 Project: Server
- 33 Project: Game
projects/wc- word-count command-line toolprojects/httpd- small HTTP serverprojects/snake- Snake game using raylib-zig
python3 validator/validator.py chapters/ --compile-onlyProject checks:
cd projects/wc && zig build test
cd ../httpd && zig build && zig build test
cd ../snake && zig buildThis work is licensed under CC BY 4.0.