-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_get_words.c
30 lines (27 loc) · 1.1 KB
/
ft_get_words.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
30
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_get_words.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: brda-sil <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/29 17:03:24 by brda-sil #+# #+# */
/* Updated: 2022/03/29 18:47:35 by brda-sil ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_get_words(char *str, char c)
{
int count;
count = 0;
while (*str)
{
while (*str && *str == c)
str++;
if (*str && *str != c)
count++;
while (*str && *str != c)
str++;
}
return (count);
}