-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_indexof.c
29 lines (26 loc) · 1.04 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
28
29
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_indexof.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kacoulib <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/07 19:25:29 by kacoulib #+# #+# */
/* Updated: 2016/12/07 19:41:51 by kacoulib ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_indexof(char *s, char c)
{
int i;
if (!s || !c)
return (-1);
i = 0;
while (s[i])
{
if (s[i] == c)
return (i);
i++;
}
return (-1);
}