42_cube3D/libftx/extra/ft_strchri.c

28 lines
1.1 KiB
C
Raw Permalink Normal View History

2023-04-26 07:02:44 -04:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchri.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/05 19:22:58 by cchauvet #+# #+# */
/* Updated: 2023/01/10 18:30:35 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#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);
}