42_minishell/utils/ft_strnchr.c
Camille Chauvet 73d1f11269 clean: norm
2023-02-21 14:35:08 +01:00

28 lines
1.0 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strnchr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/21 12:59:06 by cchauvet #+# #+# */
/* Updated: 2023/02/21 12:59:07 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "utils.h"
ssize_t ft_strnchr(const char *str, char c)
{
size_t i;
i = 0;
while (str[i] != '\0')
{
if (str[i] == c)
return (i);
i++;
}
return (-1);
}