42_solong/libftx/extra/ft_strchri.c

28 lines
1.1 KiB
C
Raw Normal View History

2023-01-06 13:37:36 -05:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchri.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/05 19:22:58 by cchauvet #+# #+# */
2023-01-10 13:04:46 -05:00
/* Updated: 2023/01/10 18:30:35 by cchauvet ### ########.fr */
2023-01-06 13:37:36 -05:00
/* */
/* ************************************************************************** */
#include "extra.h"
ssize_t ft_strchri(char *str, char c)
{
size_t i;
if (str == NULL)
return (-1);
i = 0;
while (str[i] != c && str[i] != '\0')
i++;
if (str[i] == '\0')
return (-1);
return (i);
}