42_libft/ft_strchr.c

25 lines
1.0 KiB
C
Raw Permalink Normal View History

2022-09-27 10:29:23 -04:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/26 14:44:15 by cchauvet #+# #+# */
2022-10-05 15:04:45 -04:00
/* Updated: 2022/10/05 20:56:37 by cchauvet ### ########.fr */
2022-09-27 10:29:23 -04:00
/* */
/* ************************************************************************** */
#include "libft.h"
2022-10-04 08:21:55 -04:00
char *ft_strchr(const char *s, int c)
2022-09-27 10:29:23 -04:00
{
2022-10-05 15:04:45 -04:00
while (*s != (char) c)
2022-09-27 10:29:23 -04:00
{
2022-10-04 16:04:23 -04:00
if (*s == 0)
return (NULL);
2022-09-27 10:29:23 -04:00
s++;
}
2022-10-04 16:04:23 -04:00
return ((char *) s);
2022-09-27 10:29:23 -04:00
}