#include <stdio.h>
#include <string.h>
char *strArray[]={
"Jimmy",
"Love",
"Lucy",
"One",
"Two",
"C language"
};
void QuickSort(char **ptr,int num)
{
sort(ptr,0,5);
}
void sort(char **ptr,int left,int right)
{
int i=left,j=right;
char *mid=*(ptr+(int)(left+right)/2);
do{
while((strcmp(*(ptr+i),mid)<0)&&(i<right))i++;
while((strcmp(mid,*(ptr+j))<0)&&(j>left))j--;
if(i<=j)
{
char *tmp=*(ptr+i);
*(ptr+i)=*(ptr+j);
*(ptr+j)=tmp;
i++;j--;
}
}
while(i<=j);
if(j>left) sort(ptr,left,j);
if(i<right) sort(ptr,i,right);
}
int main(int argc,int **argv)
{
char **ptr=strArray;
QuickSort(ptr,6);
for(int i=0;i<6;i++)
{
printf("%s\n",*(ptr+i));
}
}