TOC | Prev | Next

void *memchr( const void *source, int c, size_t len )

Finds a byte in memory, not unlike strchr. Returns NULL if not
found.

void *memchr( const void *source, int c, size_t len )
{
    char *p = source;
    while ( len-- ) {
        if ( *p == c )
            return p;
        p++;
    }
    return NULL;
}
TOC | Prev | Next