← Back to archive

Stdle #136 · slices · 2026-10-20

What does this Zig snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

const std = @import("std");
pub fn main() void {
const arr = [_]u8{ 10, 20, 30, 40, 50, 0 };
const sentinel: [:0]const u8 = arr[0..5 :0];
std.debug.print("{d}\n", .{sentinel.len});
}
Slices
4 attempts left

Answer & explanation