28 lines
1.0 KiB
C
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);
|
|
}
|