PatchworkOS
Loading...
Searching...
No Matches
memchr.c
Go to the documentation of this file.
1#include <string.h>
2
3void* memchr(const void* s, int c, size_t n)
4{
5 const unsigned char* p = (const unsigned char*)s;
6
7 while (n--)
8 {
9 if (*p == (unsigned char)c)
10 {
11 return (void*)p;
12 }
13
14 ++p;
15 }
16
17 return NULL;
18}
#define NULL
Pointer error value.
Definition NULL.h:23
void * memchr(const void *s, int c, size_t n)
Definition memchr.c:3