Back to course

Memory Alignment

Full Course: Zig Programming From Zero to Hero

Alignment

Memory alignment is critical for performance and hardware compatibility. Zig allows you to specify alignment for pointers and variables.

zig var x: i32 align(16) = 0; const ptr: *align(16) i32 = &x;