You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
1.1 KiB
28 lines
1.1 KiB
3 years ago
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* ft_memchr.c :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2021/10/22 15:15:55 by narnaud #+# #+# */
|
||
|
/* Updated: 2021/11/02 17:36:30 by narnaud ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
#include "libft.h"
|
||
|
|
||
|
void *ft_memchr(const void *b, int c, size_t n)
|
||
|
{
|
||
|
size_t i;
|
||
|
|
||
|
i = 0;
|
||
|
while (i < n)
|
||
|
{
|
||
|
if (*(unsigned char *)(b + i) == (unsigned char)c)
|
||
|
return ((void *)(b + i));
|
||
|
i++;
|
||
|
}
|
||
|
return (NULL);
|
||
|
}
|