Im trying to write a program to count characters and words when type a sentence but i keep getting "syntax error : missing ';' before 'type'" as an error. Anyone see where I'm going wrong? Thanks
#include <stdio.h>
#include <ctype.h>
int found_word(void);
int main()
{
int c, nw=0, nc=0;
printf("Enter a sentence>");
while (found_word() == 1)
++nw;
while ((c = getchar()) != EOF) {
if(isalpha(c))
++nc;
}
int found_word(void)
{
int c;
while (isspace(c=getchar()))
;
if (c != EOF) {
while ((c =getchar()) != EOF && !isspace(c))
;
return 1;
}
printf("Number of words = %d\n", nw);
printf("Number of characters = %d\n", nc);
return 0;
}