Updated June 2026 14 hours of live training delivered over 2 days. This course is for experienced C and C++ developers evaluating or adopting Zig. Rather than teaching programming fundamentals, every topic is presented as a translation: here is the C or C++ construct you know, here is the Zig equivalent, and here is why Zig made a different choice. It is ideal for systems programmers, embedded developers, and teams considering Zig for new components inside an existing C/C++ codebase. Zig is frequently described as a better C, and its interoperability story is unmatched: Zig speaks the C ABI natively, imports C headers directly with The course is honest about trade-offs. Students examine where C++ features like virtual dispatch and operator overloading map onto Zig idioms and where Zig deliberately declines to provide them, and they compare undefined behavior in C and C++ with Zig's safety-checked builds, where the same classes of bugs become deterministic panics in Debug and ReleaseSafe modes. The second day focuses on migration: importing and linking C libraries, using Comprehensive courseware is distributed online at the start of class. All students receive a downloadable MP4 recording of the training. Students will need a free, personal GitHub account to access the courseware. Students will need permission to install Zig 0.16 and Visual Studio Code (with the Zig language extension) on their computers. No separate C compiler is required — the Zig toolchain compiles the C and C++ code used in class. If students are unable to configure a local environment, a cloud-based environment can be provided.Zig for C and C++ Programmers
Class Duration
Student Prerequisites
Target Audience
Description
@cImport, machine-translates C source to Zig with translate-c, and compiles and links C and C++ files in the same build. This course leverages what C and C++ programmers already know. Each unit takes a familiar construct — raw pointers and arrays, goto-based cleanup or RAII destructors, errno or exceptions, NULL, preprocessor macros or templates, malloc or new, header files — and shows the Zig counterpart: slices with bounds, defer and errdefer, error unions, optionals, comptime, explicit allocators, and file-scoped modules with no preprocessor.translate-c as a starting point, and adding Zig to a real C/C++ codebase incrementally — one file, one component at a time — without a rewrite.Learning Outcomes
goto cleanup chains and RAII destructors with defer and errdefer, and articulate the trade-offs of each modeltry in place of errno conventions and C++ exceptionsNULL-related bugs with optionals and optional pointerscomptime where C uses macros and C++ uses templates, and explain what each approach can and cannot domalloc/free or new/delete@cImport, link existing C libraries, and call Zig from C via the C ABItranslate-c to bootstrap migration of C source files to ZigTraining Materials
Software Requirements
Training Topics
Orientation: Why Zig Exists
Pointers, Arrays, and Slices
@alignCastCleanup: defer and errdefer vs. RAII and goto
goto cleanup pattern in C and its failure modesdefer for unconditional cleanuperrdefer for error-path-only cleanupErrors: Error Unions vs. errno and Exceptions
errno, return codes, and out-parameters in Ctry, catch, and switch on errorsOptionals vs. NULL
orelse, if unwrapping, and .?comptime vs. Macros and Templates
comptime parameters@typeInfo reflectionMemory: Allocators vs. malloc and new
Allocator parameter conventionCode Organization: Modules vs. Headers
@import vs. #includepub vs. header/implementation splitsC and C++ Interop and Migration
@cImport and importing C headers directlytranslate-c: machine-translating C source to Zigbuild.zigSafety: UB in C/C++ vs. Safety-Checked Builds
unreachable and @setRuntimeSafety actually doWhere C++ Features Map — and Deliberately Don't