home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_08_12 / 8n12092b < prev    next >
Text File  |  1990-10-09  |  411b  |  26 lines

  1.  
  2. Listing 3
  3.  
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <string.h>
  7.  
  8. int comp(unsigned char **, unsigned char **);
  9. unsigned char *list[] = { "cat", "car", "cab", "cap", "can" };
  10.  
  11. main()
  12. {
  13. int x;
  14.  
  15. qsort(list, 5, sizeof(unsigned char *), comp);
  16. for (x = 0; x < 5; x++)
  17.   printf("%s\n", list[x]);
  18. return 0;
  19. }
  20.  
  21. int comp(unsigned char **a, unsigned char **b)
  22. {
  23. return strcmp(*a, *b);
  24.  }
  25.  
  26.