#include <unistd.h>
int ft_count_word(char *str)
{
int word;
int inter;
int i;
i = 0;
word = 0;
inter = 0;
while (str[i])
{
if (str[i] >= 33 && str[i] <= 126)
{
if (inter == 0)
{
inter = 1;
word++;
}
}
else
inter = 0;
i++;
}
return (word);
}
#include <stdio.h>
int main(void)
{
printf("%i", ft_count_word("salut tu va bien "));
return (0);
}
To embed this project on your website, copy the following code and paste it into your website's HTML: