29 lines
1.1 KiB
C
29 lines
1.1 KiB
C
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* ft_strchri.c :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2023/01/05 19:22:58 by cchauvet #+# #+# */
|
||
|
/* Updated: 2023/01/05 19:23:13 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);
|
||
|
}
|
||
|
|