libft/memory/ft_memchr.c
Raphael ed64bd73d6
docs(memory): moving the actual documentation on the header
- The documentation on the header allow u to see on the files where the
header is inclued
2025-09-05 16:29:40 +02:00

30 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/07 16:48:30 by rparodi #+# #+# */
/* Updated: 2025/09/05 16:26:04 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#include "memory.h"
#include <unistd.h>
void *ft_memchr(const void *s, int c, size_t n)
{
size_t i;
char *str;
i = 0;
str = (char *)s;
while (i < n)
{
if ((char)c == str[i])
return ((void *)str + i);
i++;
}
return (NULL);
}