libft_old/extended_libft/ft_memchr.c
Willem Haffmans 326f52308e all
2024-07-26 22:32:04 +02:00

25 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: whaffman <whaffman@student.codam.nl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/05 18:42:07 by whaffman #+# #+# */
/* Updated: 2024/07/10 11:36:51 by whaffman ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memchr(const void *s, int c, size_t n)
{
while (0 < n--)
{
if (*(unsigned char *)s == (unsigned char) c)
return ((void *) s);
s++;
}
return (NULL);
}