-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strchind.c
executable file
·26 lines (23 loc) · 1.09 KB
/
ft_strchind.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strchind.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tseguier <tseguier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/01/14 01:44:02 by tseguier #+# #+# */
/* Updated: 2014/03/27 18:39:46 by jcoignet ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
#include "libft.h"
int ft_strchind(const char *str, char c)
{
int i;
i = 0;
if (!str)
return (-2);
while (*(str + i) != c && *(str + i) != '\0')
++i;
return (*(str + i) != '\0' ? i : -1);
}