help..my c program is counting "SPACE" i dont want to count it as "Word" can anybody help??
here's my code:
Code:#include<stdio.h> #include<ctype.h> #include<string.h> int main(){ char str[1000], p; int i, count=1; printf("Enter a string: "); gets(str); for (i=0; str[i]!='\0'; i++){ if(str[i]==' '){ count++; } } printf("There are %d words\n\n",count); for (i=0; str[i]!='\0'; i++){ if(str[i]==' '){ printf("\n"); } else{ printf("%c", str[i]); } } printf("\n"); return 0; }