Strings In Depth1 / 19
Up next

String literals

const std = @import("std");

pub fn main() void {
    // a string literal is a pointer to a null-terminated byte array
    const greeting = "hello";
    // it coerces freely to a []const u8 slice
    const view: []const u8 = greeting;
    std.debug.print("{s} has {d} bytes\n", .{ view, view.len });
}
What you're solving

a literal is a const byte array pointer