#include <stdio.h>
int main()
{
char ch[100] = "";
void sum(char* ch);
gets(ch);
sum(ch);
puts(ch);
return 0;
}
void sum(char *ch)
{
int character=0,number=0,others=0;
int i = 0;
while(ch[i]!='\0')
{
if((ch[i]>='A'&&ch[i]<='Z')||(ch[i]>='a'&&ch[i]<='z'))character++;
else if(ch[i]>='0'&&ch[i]<='9')number++;
else others++;
i++;
}
printf("character:%d\tnumber:%d\tothers:%d\n",character,number,others);
}
刚看到了忘了问,如果要返回实参输出那应该怎么改,char*ch是指针么,刚准备学,可以的话说一下用法谢谢