Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function

findSentinel

Public Function
std.mem.findSentinel
pub fn findSentinel(comptime T: type, comptime sentinel: T, p: [*:sentinel]const T) usize

Returns the index of the sentinel value in a sentinel-terminated pointer. Linear search through memory until the sentinel is found.

Params

  • T: type
  • sentinel: T
  • p: [*:sentinel]const T

File

mem.zig:1149
1149
1150
1151
1152
1153
1154
1155
pub fn findSentinel(comptime T: type, comptime sentinel: T, p: [*:sentinel]const T) usize {
    var i: usize = 0;
    while (p[i] != sentinel) {
        i += 1;
    }
    return i;
}