#include
void Count(int num[], const char *p)
{
char c;
if(!p || !num )
{
printf("参数为空!\n");
return;
}
num[0] = 0;
num[1] = 0;
num[2] = 0;
while (*p)
{
c = *p;
if (c <= 'z' && c >= 'a')
{
++num[0]; //统计 a-z
}
else if( c <= 'Z' && c >= 'A')
{
++num[1];//统计 A-Z
}
else if( c <= '9'&& c >= '0' )
{
++num[2];//统计 0-9
}
p++;
}
}
int main()
{
char *p = "32fzaaAwEAAZZZ";
int num[3];
Count(num, p);
printf("a-z的数量是%d个, A-Z的数量是%d个, 0-9的数量是%d个\n", num[0], num[1], num[2]);
return 0;
}