给个例子你看看就知道了....
#include <stdio.h>
#include<string.h>
int main()
{
char hh[10][20]={"George","Beint","cihoi","zong","iwjkdf","About","Bady"};//对字符串数组赋值.
int i,j;
char qhg[10];
for(i=0;i<7;i++)
{
for(j=i+1;j<7;j++)
{
if(strcmp(hh[i],hh[j])<0)
{
strcpy(qhg,hh[i]);
strcpy(hh[i],hh[j]);
strcpy(hh[j],qhg);
}
}
}
for(i=0;i<7;i++)
printf("%s\n",hh[i]);
}