#include <stdio.h>
void count(char *string);
int main()
{
char string[] = "abc123 #$%";
count(string);
return 0;
}
void count(char *string){
int a=0,b=0,c=0,d=0;
while (*string!='\0')
{
/* code */
if ((*string>='a') && (*string<='z') || (*string>='A') && (*string>='Z'))
{
/* code */
a++;
}else if((*string>='0') && (*string<='9') ){
b++;
}else if(*string==' '){
c++;
}else{
d++;
}
string ++;
}
printf("zhimu = %d,shuzhi = %d, kongge = %d, qita = %d.\n",a,b,c,d);
}