找到了一个 关于数单词个数的程序 可是看不懂 求解释~
#include <stdio.h>int main(void)
{
char c;
int count, word;
int repeat, ri;
scanf("%d", &repeat);
getchar();
for(ri = 1; ri <= repeat; ri++){
c = getchar();
count=0;
word=c;
while(c!='\n') {
if(word!=' '&&c==' ') count ++;
word=c;
c=getchar();}
c=' ';
if(word!=' '&&c==' ') count ++;
printf("count = %d\n", count);
}
}