#include <stdio.h>
int space(char c)
{
return (c <= 32);
}
int wordcount(char *str)
{
int count = 0;
int word = 0;
while (*str)//d
{
if (space(*str))// !
{
word = 0;
}
else // >>
if (word == 0)
{
word = 1;
count++;
}
str++;
}
return count;
}
int main() {
char *s = "d";
printf("%d",wordcount(s));
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: