-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_indexof.c
27 lines (25 loc) · 1.03 KB
/
ft_indexof.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_indexof.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ayano <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/06/24 14:28:14 by ayano #+# #+# */
/* Updated: 2019/06/24 14:28:48 by ayano ### ########.fr */
/* */
/* ************************************************************************** */
int ft_indexof(char *str, char c)
{
int i;
i = 0;
if (!str)
return (-1);
while (str[i])
{
if (str[i] == c)
return (i);
i++;
}
return (-1);
}