#include<stdio.h>
/*..............................main().............................................*/
int main()
{
void sort(char *name[],int n);
void print(char *name[],int n);
static char *name[]={ "CHINA","AMERICA","AUSTRALIA",
"FRANCE","GERMAN"};
int n=5;
sort(name,n);
print(name,n);
}
/*.......................void sort(char *name[],int n)....................................................*/
void sort(char *name[],int n)
{
char *pt;
int i,j,k;
for(i=0;i<n-1;i++)
{
k=i;
for(j=i+1;j<n;j++)
if(strcmp(name[k],name[j])>0) k=j;
if(k!=i)
{
pt=name[i];
name[i]=name[k];
name[k]=pt; /*在这的k为什么不能换成j??????*/
}
}
}
/*..................................................void print(char *name[],int n).........................................*/
void print(char *name[],int n)
{
int i;
for (i=0;i<n;i++) printf("%s\n",name[i]);
}