[求助]怎么改可以把这个程序改成非字母开头也能查找呢?
查找首字母为某一特定字母的字符串
#include<stdio.h>
int StartWith( char *, char );
main()
{
char *str[]={ "Hunan", "Shangxi", "Shandong", "Beijing", "Hebei"};
char * result[5];
int i,j=0;
for(i=0;i<5;i++)
{
if(StartWith(str[i], 'H'))
result[j++]=str[i];
}
if(j==0)
printf(" no found!");
else
for (; j>=0;j--)
printf(" %s\n", result[j]);
}
int StartWith(char *str, char key)
{
if(*str==key)
return 1;
else
return 0;
}