Back to course

Unsafe Zig: @ptrCast and @intToPtr

Full Course: Zig Programming From Zero to Hero

Unsafe Operations

Sometimes you need to do things the compiler can't verify. Zig makes this explicit with @ functions.

  • @ptrCast: Converts one pointer type to another.
  • @intToPtr: Converts an address (integer) to a pointer.

Use these sparingly, as they bypass safety checks.