home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / c / 12247 < prev    next >
Encoding:
Internet Message Format  |  1992-08-12  |  1.1 KB

  1. Path: sparky!uunet!dtix!darwin.sura.net!aplcen.apl.jhu.edu!bandy
  2. From: bandy@aplcen.apl.jhu.edu (Mike Bandy)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: qsort problem....
  5. Message-ID: <1992Aug12.220456.25928@aplcen.apl.jhu.edu>
  6. Date: 12 Aug 92 22:04:56 GMT
  7. References: <1992Aug10.184635.11618@tin.monsanto.com>
  8. Organization: Johns Hopkins University
  9. Lines: 37
  10.  
  11. bcschu@skws02.monsanto.com (Brett Schultz) writes:
  12.  
  13. >Hello, for some reason I am having a problem with a qsort system call.  
  14. >
  15. >Here is a test program similar to what I am trying to do:
  16. >
  17. >#include <stdio.h>
  18. >#include <stdlib.h>
  19. >typedef struct my_float {
  20. >    float f;
  21. >}my_float;
  22. >
  23. >
  24. >
  25. >main()
  26. >{
  27.    int qs_compare();            /*** ADD THIS LINE ***/
  28. >  my_float mf[5];
  29. >  int i;
  30. > ... (deleted) ...
  31.  
  32. >  /*qsort((void *) mf, 5, sizeof(my_float), qs_compare);*/
  33.  
  34. > ... (deleted) ...
  35. >}
  36. >
  37. >int qs_compare(my_float *a,my_float *b)
  38. >{
  39. > ... (deleted) ...
  40.  
  41.  
  42. My background is with Lattice/SAS C for the Amiga and VAX/VMS C.
  43. I've used this routine numerous times and your approach seems right but
  44. for the missing definition.
  45.  
  46.     Mike Bandy
  47.     Johns Hopkins University - Applied Physics Lab
  48.