Archived
1
0
This repository has been archived on 2024-10-25. You can view files and clone it, but cannot push or open issues or pull requests.
libft/ft_memchr.c

27 lines
1.1 KiB
C
Raw Normal View History

2023-11-05 15:12:25 +01:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/05 14:52:53 by adjoly #+# #+# */
2023-11-06 17:25:35 +01:00
/* Updated: 2023/11/06 15:37:15 by adjoly ### ########.fr */
2023-11-05 15:12:25 +01:00
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memchr(const void *s, int c, size_t n)
{
2023-11-06 17:25:35 +01:00
int i;
i = 0;
while (i < n && ((unsigned char *)s)[i] && ((char *)s) != c)
{
s++;
i++;
}
return (NULL);
2023-11-05 15:12:25 +01:00
}