#length of sentinel terminated
1 messages · Page 1 of 1 (latest)
slice.len
Hmm, that's what I'm doing, and it isn't working as I expect.
My code looks like this:
var score_buf: [11:0]u8 = undefined;
if (std.fmt.bufPrint(&score_buf, "{}", .{snake1_score})) |_| {
// ...
}
But when I call score_buf.len, the value is always 11.
bufPrint returns a slice into the buffer, use that
the buffer itself can't have its length changed
Oh. So score_buf len will always be 11.
yea, its an array not a slice, length is constant
Hmm. The buf returned always seems to be 11 too 🤔
show your code