-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathft_wordcount.c
More file actions
31 lines (28 loc) · 1.08 KB
/
ft_wordcount.c
File metadata and controls
31 lines (28 loc) · 1.08 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_wordcount.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mimeyer <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/05/22 08:19:34 by mimeyer #+# #+# */
/* Updated: 2019/05/28 11:27:16 by mimeyer ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_wordcount(const char *s, char c)
{
size_t i;
size_t w;
i = 0;
w = 0;
while (s[i])
{
if (s[i] != c)
w++;
while (s[i] != c && s[i + 1])
i++;
i++;
}
return (w);
}