25 lines
1.1 KiB
C
25 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_memchr.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: tosuman <timo42@proton.me> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/05/22 16:34:06 by tosuman #+# #+# */
|
|
/* Updated: 2023/05/22 16:34:06 by tosuman ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include <stddef.h>
|
|
|
|
void *ft_memchr(const void *s, int c, size_t n)
|
|
{
|
|
unsigned char *us;
|
|
|
|
us = (unsigned char *) s;
|
|
while (n--)
|
|
if (*us++ == (unsigned char) c)
|
|
return (--us);
|
|
return (0);
|
|
}
|