3 /* memchr( const void *, int, size_t )
5 This file is part of the Public Domain C Library (PDCLib).
6 Permission is granted to use, modify, and / or redistribute at will.
13 void * memchr( const void * s, int c, size_t n )
15 const unsigned char * p = (const unsigned char *) s;
18 if ( *p == (unsigned char) c )
30 #include <_PDCLIB_test.h>
34 TESTCASE( memchr( abcde, 'c', 5 ) == &abcde[2] );
35 TESTCASE( memchr( abcde, 'a', 1 ) == &abcde[0] );
36 TESTCASE( memchr( abcde, 'a', 0 ) == NULL );
37 TESTCASE( memchr( abcde, '\0', 5 ) == NULL );
38 TESTCASE( memchr( abcde, '\0', 6 ) == &abcde[5] );