Listing 1 Sorts command line arguments with qsort

/* sortargs.c
 * from C users Journal p84 Oct 1993
 * Chuck Allison Listing 1 sortargs.c
 * sorts command line arguments with qsort
 *
 */

 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>

 int comp(const void *,const void *);

 main(int argc, char *argv[])
 {
     qsort(argv+1,argc-1,sizeof(argv[0]),comp);
     while(--argc)
        puts (*++argv);
     return 0;
 }

 int comp(const void *p1,const void *p2)
 {
     const char *ps1 = * (char **)p1;
     const char *ps2 = * (char **)p2;

     return strcmp(ps1,ps2);

/* End of File */