26 lines
1.1 KiB
C
26 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_memchr.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: grobledo <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/02/08 20:08:44 by grobledo #+# #+# */
|
|
/* Updated: 2023/02/08 20:08:45 by grobledo ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
#include "libft.h"
|
|
|
|
void *ft_memchr(const void *str, int c, size_t n)
|
|
{
|
|
size_t i;
|
|
|
|
i = 0;
|
|
while (i < n)
|
|
{
|
|
if ((((unsigned char *)str)[i]) == (unsigned char)c)
|
|
return ((void *)str + i);
|
|
i++;
|
|
}
|
|
return (NULL);
|
|
}
|