c程序 统计各个数字、空白符出现的次数,有错

#include
#include

int main()
{
int c,i,nwhite,nother;
int ndigit[10];

nwhite = nother = 0;
for (i=0;i<10;++i)
{
    ndigit[i]=0;
}
printf("--------------\n");
while((c=getchar())!=EOF)
{

    if(c>='0'&&c<='9')
    ++ndigit[c-'0'];
    else if(c==' '||c=='\n'||c=='\t')
        ++nwhite;
    else
        ++nother;
}
printf("digits =");
for (i = 0; i<10;++i)
    printf("%d",ndigit[i]);
printf(",white space = %d,other =%d\n",nwhite,nother);
return 0;

}
编译器显示no error,但是编译后出不来结果

^Z(ctrl+z)是MS-DOS操作系统中文件字符的末尾,在程序中用EOF表示。

知道了,要按Ctrl+z结尾,可是不知道为什么

你确定输入可以有EOF吗?

什么叫出不来结果?我试了下你的代码,能出来结果。个人不太懂你建个整型数组的意思