libft/str/ft_strchr.c
Raphael 2cf0714dc7
docs(str): 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:30:00 +02:00

30 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/07 16:32:19 by rparodi #+# #+# */
/* Updated: 2025/09/05 16:17:50 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#include "str.h"
#include <unistd.h>
char *ft_strchr(const char *s, int c)
{
unsigned int i;
i = 0;
if (c == 0)
return ((char *)s + ft_strlen(s));
while (s[i] != '\0')
{
if (s[i] == (char)c)
return ((char *)s + i);
i++;
}
return (NULL);
}