代码
#include<stdio.h>
#include<string.h>
void Sort(char a[25][15]);
int main(void)
{
int c;
char a[25][15]={"Xing","Gnuplot","is","a","command-driven", "interactive","function","plotting","program","If","files","are","given","gnuplot"," loads","each","file","with","the","load","command","in","the","order","specified"};
printf("original:");
for(c=0;c<25;c++){
printf("%s ",&a[c][0]);
}
printf("\n");
printf("sort:");
Sort(a);
for(c=0;c<25;c++){
printf("%s ",&a[c][0]);
}
return 0;
}
void Sort(char a[25][15])
{
int i,j,k;
char temp[20];
char *si,*sj;
for(j=0;j<24;j++){
for(i=j+1;i<25;i++){
si=a[i],sj=a[j];
if(strcmp(sj,si)>0){
strcpy(temp,si);
strcpy(si,sj);
strcpy(sj,temp);
}
}
}
}