#Hi guys, I don't understand what this "sentinels in arrays" thing is. Could you explain it better?
1 messages · Page 1 of 1 (latest)
It's just that the array is followed by an additional element (beyond the length) – the sentinel. Usually (especially in strings), the sentinel is a 0.
So it's like an extra feature? I mean, if I have an array of characters like 'a','b', 'c', would the refrain be '0'? Like in C with '\0'?
Yes, that's especially made for compatibility with C strings, while preserving Zig's known length approach.