统计单词个数的程序,询问下错误
#define N 81#include "stdio.h"
void main()
{
char string[N];
char c;
int i;
int num=0,word=0;
gets(string);
for(i=0;(c=string[i]!='\0');i++)
{
if(c==' ')
word=0;
else if(word==0)
{
word=1;
num++;
}
}
printf("There are %d words in the Array String",num);
}
num始终输出1....