I need to write a function that will count words in a string. For the purpose of this assignment, a \"word\" is defined to be a sequence of non-null, non-whitespace characte
#include int main() { char str[50]; int i, count=1; printf("Enter a string:\n"); gets(str); for (i=0; str[i]!='\0'; i++) { if(str[i]==' ') { count++; } } printf("%i\n",count); }