wip_parsing
This commit is contained in:
29
libft/mem/ft_memchr.c
Normal file
29
libft/mem/ft_memchr.c
Normal file
@ -0,0 +1,29 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_memchr.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: madumerg <madumerg@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/10/31 14:41:18 by madumerg #+# #+# */
|
||||
/* Updated: 2023/11/09 16:24:27 by madumerg ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
void *ft_memchr(const void *s, int c, size_t n)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
i = 0;
|
||||
if (!s)
|
||||
return (0);
|
||||
while (i < n)
|
||||
{
|
||||
if (*(unsigned char *)(s + i) == (unsigned char)c)
|
||||
return ((void *)(s + i));
|
||||
i++;
|
||||
}
|
||||
return (0);
|
||||
}
|
Reference in New Issue
Block a user