k-tana-zero/libs/libc/memchr.c
Julien CLEMENT 7178dbb6a7 feat: add given files
Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
2021-07-12 15:57:08 +02:00

13 lines
178 B
C

#include <stddef.h>
void *memchr(const void *s, int c, size_t n)
{
const char *data = s;
while (n--)
if (*data++ == (char)c)
return (void *)(data - 1);
return NULL;
}