qsort function


qsort will sort an array of elements. This is a wild function that uses a pointer to another function that performs the required comparisons.

Library:   stdlib.h

Prototype: void qsort(void *base, 
		      size_t num, 
		      size_t size, 
 		      int (*comp_func)(const void *, const void *))


Some explanation.


Notes

  1. Well... This caused me alot of trouble! Although the prototype above is exactly as shown in the documentation, the last parm kept giving compiler warnings (invalid pointer type) this is the fix.
    	
    Prototype: void qsort(void *base, 
    		      size_t num, 
    		      size_t size, 
     		      (void *) (*comp_func)(const void *, const void *))
    
    does anyone know the answer to this problem??

  2. I think void * needs an explanation.

  3. And cast aswell


Example program 1 As basic as I can make it.

Example program with user input.

O'Reilly 'Using C' example.


Top Master Index Keywords Functions


Martin Leslie

or

diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2016-11-10 16:07:32 -0700
committerTony Lindgren <tony@atomide.com>2016-11-10 16:07:32 -0700
commit19944b3a4a30163656b26e9d2ca659657113ac3e (patch)
tree0124225bb262710d6463087845a7c06c35e3e4c7
parentdbf828ec4c765623dfd1ff91ca9c1dccbe7a3da3 (diff)
ARM: OMAP2+: Drop legacy sdram timings
These are no longer used. If somebody needs to configure memory timings for various idle modes, they should be implemented as a device driver callbacks from the PM code. Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat