Skip to content

Instantly share code, notes, and snippets.

@nickcernis
Last active May 3, 2024 19:48
Show Gist options
  • Save nickcernis/2f8dc6b04f19e5045686a2ad829db110 to your computer and use it in GitHub Desktop.
Save nickcernis/2f8dc6b04f19e5045686a2ad829db110 to your computer and use it in GitHub Desktop.
Zig Cheatsheets

From Ziglings.

     FREE ZIG POINTER CHEATSHEET! (Using u8 as the example type.)
   +---------------+----------------------------------------------+
   |  u8           |  one u8                                      |
   |  *u8          |  pointer to one u8                           |
   |  [2]u8        |  two u8s                                     |
   |  [*]u8        |  pointer to unknown number of u8s            |
   |  [*]const u8  |  pointer to unknown number of immutable u8s  |
   |  *[2]u8       |  pointer to an array of 2 u8s                |
   |  *const [2]u8 |  pointer to an immutable array of 2 u8s      |
   |  []u8         |  slice of u8s                                |
   |  []const u8   |  slice of immutable u8s                      |
   +---------------+----------------------------------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment