0PricingLogin
Zig Academy · Lesson

Strings Are []const u8

Why Zig strings are byte slices.

No String Type

Zig has no dedicated string type. A piece of text is simply a slice of bytes, so you reuse the same tools you already know for arrays. 📦

It Is Just Bytes

A Zig string is the type []const u8: a read-only window over a run of 8-bit bytes. Each byte holds one number from 0 to 255.

const greeting: []const u8 = "hello";

All lessons in this course

  1. Strings Are []const u8
  2. String Literals and Escapes
  3. Comparing and Searching Bytes
  4. Formatting Text with std.fmt
← Back to Zig Academy