#include <stdio.h>
#include <string.h>
void sort(char *p[],int n)
{
int i,j;
char *temp;
for(i=0;i<n-1;i++)
{
for(j=0;j<n-1-i;j++)
{
if(strcmp(p[j],p[j+1])>0)
{
temp=p[j];
p[j]=p[j+1];
p[j+1]=temp;
}
}
}
}
int main()
{
int i;
char *p[]={"abc","aabdfg","abbd","dcdbe","cd"};
sort(p,5);
for(i=0;i<5;i++)
{
puts(p[i]);
}
system("pause");
return 0;
}
//可以看看這個程序