- The documentation on the header allow u to see on the files where the header is inclued
30 lines
1.1 KiB
C
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);
|
|
}
|