2024-04-24 10:53:46 +02:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* ::: :::::::: */
|
|
|
|
/* ft_strchr.c :+: :+: :+: */
|
|
|
|
/* +:+ +:+ +:+ */
|
2024-04-29 13:53:00 +02:00
|
|
|
/* By: mmoussou <mmoussou@student.42angoulem +#+ +:+ +#+ */
|
2024-04-24 10:53:46 +02:00
|
|
|
/* +#+#+#+#+#+ +#+ */
|
2024-04-29 13:53:00 +02:00
|
|
|
/* Created: 2023/11/01 22:01:50 by mmoussou #+# #+# */
|
|
|
|
/* Updated: 2023/11/13 19:39:47 by mmoussou ### ########.fr */
|
2024-04-24 10:53:46 +02:00
|
|
|
/* */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
2024-04-29 13:53:00 +02:00
|
|
|
#include "libft.h"
|
2024-04-24 10:53:46 +02:00
|
|
|
|
|
|
|
char *ft_strchr(const char *s, int c)
|
|
|
|
{
|
2024-04-29 13:53:00 +02:00
|
|
|
size_t i;
|
2024-04-24 10:53:46 +02:00
|
|
|
|
2024-04-29 13:53:00 +02:00
|
|
|
i = 0;
|
|
|
|
if (!s)
|
|
|
|
return (NULL);
|
|
|
|
while (s[i])
|
|
|
|
{
|
|
|
|
if (s[i] == (unsigned char)c)
|
|
|
|
return (&((char *)s)[i]);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
if (!c)
|
|
|
|
return (&((char *)s)[i]);
|
|
|
|
return (NULL);
|
2024-04-24 10:53:46 +02:00
|
|
|
}
|