24 lines
1.1 KiB
C
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);
|
|
}
|