-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_cwords.c
More file actions
31 lines (28 loc) · 1.1 KB
/
ft_cwords.c
File metadata and controls
31 lines (28 loc) · 1.1 KB
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
30
31
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_cwords.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ppanchen <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/30 16:23:18 by ppanchen #+# #+# */
/* Updated: 2016/11/30 16:27:17 by ppanchen ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_cwords(char const *s, char c)
{
int i;
int j;
i = 0;
j = 0;
if (s[0] != c && ft_strlen(s) != 0)
j++;
while (s[i])
{
if (s[i] == c && s[i + 1] != c && s[i + 1] != 0)
j++;
i++;
}
return (j);
}