用函数比较字符大小
#include<stdio.h>#include<string.h>
#define n 10
void sort(char a[n])
{int i,j; char t;
for (i=0;i<n-1;i++)
{for (j=0;j<n-1-i;j++)
{ if (strcmp(a[j],a[j+1])>0)
{t=a[j];a[j]=a[j+1];a[j+1]=t;}}}
puts (a);
}
void main()
{void sort(char a[n]);
char a[n];
printf("please input a[10]:");
gets (a);
sort(a) ;
}