fillit/libft/ft_memchr.c
Gregory Tertyshny d1cabbc8d5 initial commit
2016-12-26 18:48:33 +02:00

24 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/29 15:55:30 by gtertysh #+# #+# */
/* Updated: 2016/11/30 18:51:40 by gtertysh ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memchr(const void *s, int c, size_t n)
{
while (n--)
{
if (*(unsigned char *)s == (unsigned char)c)
return ((unsigned char *)s);
s++;
}
return (NULL);
}