Hi friends, In the following program when I am using '-' in the expression "ndigit[c - '0'];" I am getting correct result but wen I am using + then I am not getting the answer, am I missing something, please answer.
#include <stdio.h>
int main()
{
int c,i;
int ndigit[10];
for(i=0;i<10;++i)
ndigit[i]=0;
while((c=getchar())!=EOF)
{
if (c>='0' && c<='9')
++ndigit[c - '0'];
}
printf("digits=");
for(i=0;i<10;i++)
printf("%d",ndigit[i]);
}