hello experts i am learning K&R array program i have a lot of doubts please help me
How the output shows as digits = 2 1 1 1 1 1 1 1 1 1 ?
Code:
#include<stdio.h>
int main()
{
int c,i,nwhite,nother;
int ndigit[10];
nwhite = nother = 0;
for(i = 0; i < 10; ++i)
ndigit[i] = 01
;
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);
}
In put
1
2
3
4
5
6
7
8
9
0
l
a
s
d
f
Output
digits = 2 1 1 1 1 1 1 1 1 1 ,white space = 0, other = 14
thanks