#include "stdafx.h"
/* QSORT.C: This program reads the command-line
* parameters and uses qsort to sort them. It
* then displays the sorted arguments.
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
int compare( const void *arg1, const void *arg2 );
void main( int argc, char **argv )
{
char a[255]="1723649\0";
int k=strlen(a);
qsort((void *)a,(size_t)strlen(a),sizeof(char),compare);
printf ("%s",a);
}
int compare( const void *arg1, const void *arg2 )
{
return -(((char *)arg1)[0]-((char*)arg2)[0]);//降序,这个值取负则为升序
}