42_libft/ft_strchr.c

25 lines
1.0 KiB
C
Raw 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-04 16:04:23 -04:00
/* Updated: 2022/10/04 15:08:26 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-04 16:04:23 -04:00
while (*s != 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
}