/*************************************************************************
 **  函数名称: QuickSort
 **  功能描述: 指针数组快速排序
 **  输入参数: char *array[]  指针数组
 **            int  left      起始位置
 **            int  right     结束位置
 **  输出参数:
 **  返回结果:
 **
  ************************************************************************/
/* 指针数组快速排序 */
int QuickSort(char *array[], int left, int right)
{
   if(left>right)
      return 0;
     
   /* 取最左边的值为pivot(基准)*/
   int i = left;
   int j = right;
   char *pivot = array[left];
   while( i<j )
   {
     while((i<j) && ((strncmp(pivot, array[j], LEN_MCHNO)<0) || (strncmp(pivot, array[j], LEN_MCHNO)==0)))
        j--;
       
     if(i<j )
        array[i++] = array[j];
 
     while((i<j) && ((strncmp(pivot, array[i], LEN_MCHNO)>0) || (strncmp(pivot, array[i], LEN_MCHNO)==0)))
        i++;
            
     if(i<j)
        array[j--]=array[i];
   }
   array[j] = pivot;
   QuickSort(array,left,i-1);
   QuickSort(array,i+1,right);
}
原文:https://www.cnblogs.com/Yloon/p/12096070.html