Oki I'm trying to lean C so don't blame on me, I'm having problems with this switch, the program itself is useless I'm just trying to learn the language syntax, here goes the code:
Code:
#include<stdio.h>
//Dumb Program to Count Digits
int main(){
int c, i, nblanks, nothers, ndigit[10];
nblanks = nothers = 0;
for (i = 0;i < 9;i++)
ndigit[i] = 0;
while ((c=getchar())!= EOF)
{
switch(c){
case:'0':case:'1':case:'2':case:'3':case:'4':
case:'5':case:'6':case: '7':case:'8':case:'9':
ndigit[c-'0']++;
break;
case ' ':
case '\n':
case '\t':
nblanks++;
break;
default:
nothers++;
break;
}
}//switch
printf("Digits = ");
for (i = 0; i < 10; i++)
printf("%d",ndigit[i]);
printf("Blanks = %d and Others = ",nblanks,nothers);
return 0;
}//main
It says I have a parse error before : at line 13, also says that I have unreachable code on the beginning of the switch statement, can you folks helo me?