-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_calcwords.c
27 lines (25 loc) · 1.06 KB
/
ft_calcwords.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_calcwords.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: twakrim <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/10/22 21:00:56 by twakrim #+# #+# */
/* Updated: 2018/10/24 21:38:34 by twakrim ### ########.fr */
/* */
/* ************************************************************************** */
int ft_calcwords(const char *str, char c)
{
int i;
int j;
i = 0;
j = 0;
while (str[i])
{
if (str[i] != c && (str[i + 1] == c || str[i + 1] == '\0'))
j++;
i++;
}
return (j);
}