This commit is contained in:
null
2025-08-04 13:20:27 +02:00
commit d215954dec
43 changed files with 1931 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/11 09:03:40 by yantoine #+# #+# */
/* Updated: 2024/10/25 21:46:01 by yantoine ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memchr(const void *s, int c, size_t n)
{
unsigned char *p;
size_t index;
p = (unsigned char *)s;
index = 0;
while (p[index] && index < n)
{
if (p[index] == (unsigned char) c)
return ((void *)(p + index));
index++;
}
return (NULL);
}