include
include
void sort(char string,int n)
{
int numA = 0, numa = 0, num1 = 0, num_ = 0;
for (int i = 0; (string+i) = '\0'; i++)
{
if ('0' <= (string + i) <= '9')
{
num1++;
}
else if ('A' <= (string + i) <= 'Z')
{
numA++;
}
else if ('a' <= (string + i) <= 'z')
{
numa++;
}
else
{
num++;
}
}
printf("number:%d,majuscule:%d,lowercase:%d,others:%d", num1, numA, numa, num);
}
int main()
{
char string;
int n;
printf("Please input the number of the string:");
scanf_s("%d", &n);
getchar();
string = (char)malloc( (n+1) sizeof(string));
printf("Please input the string:");
gets(string);
sort(string, n);
free(string);
return 0;
}

这里用来分别计数字符串中大小写字母,数字,其他符号个数,但是输出为0,为什么?