42_minishell/utils/ft_strnchr.c

28 lines
1.0 KiB
C
Raw Normal View History

2023-02-21 08:35:08 -05:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 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 */
/* */
/* ************************************************************************** */
2023-02-01 11:28:38 -05:00
#include "utils.h"
2023-02-09 12:47:05 -05:00
ssize_t ft_strnchr(const char *str, char c)
2023-02-01 11:28:38 -05:00
{
size_t i;
i = 0;
while (str[i] != '\0')
{
if (str[i] == c)
return (i);
i++;
}
return (-1);
}