函数调用的不可以执行!
#include<iostream>using namespace std;
int main()
{
int letter=0,digit=0,space=0,other=0;
int i;
char *p,string[20];
void search(char *p,char string[]);
cout<<"input string:"<<endl;
while((string[i]=getchar())!='\n')
i++;
search(p,string);
cout<<"letter="<<letter<<endl<<"space="<<space<<endl<<"digit="<<digit<<endl<<"other="<<other<<endl;
return 0;
}
void search (char *p,char string[])
{
int letter=0,digit=0,space=0,other=0;
p=&string[0];
while(*p!='\n')
{
if(('a'<=*p)&&(*p<='z')&&('A'<=*p)&&(*p<='z'))
++letter;
else if(*p==' ')
++space;
else if((*p<='9')&&(*p>='0'))
++digit;
else
++other;
p++;
}
}