This is a program which display the number of words in a string. I manage to make a function call but gives me an error of "Arguments list syntax error". Any answer would be a such great help.
#include<stdio.h>
int wordCount(char str[],int b);
main()
{
char str[100];
int b, d;
clrscr(); // clear the screen every compile and build
printf("Write your message: ");
gets(str); //reads the str[] which the user input
b = strlen(str); // run without the <string.h>
d = wordCount(str,b);
printf("No. of words: %d", d);
getch();
}
int count(str[],b) // Where the error points out
{
int i=0,word=0;
for (i = 0; i < b; i++)
{
if (str[i] != ' ' && str[i] != '\t')
{
word++;
while (str[i] != ' ' && str[i] != '\t')
{
i++;
}
}
}
return word;
}