qsort_C.c [SRC] [CPP] [JOB] [SCAN]
SOURCES / FUNCTIONS



   1 | #include <stdio.h>
   2 | #include <stdlib.h>
   3 | #ifdef MAC
   4 | #include <sys/malloc.h> // mac os x
   5 | #else
   6 | #include <malloc.h> // linux, windows
   7 | #endif
   8 | 
   9 | int compare (const void * a, const void * b);
  10 | 
  11 | void qsort_C ( int* table,int nbline, int sizeline)
  12 | {
  13 |   qsort (table, nbline, sizeline, compare);
  14 | }
  15 | 
  16 | int compare (const void * a, const void * b)
  17 | {
  18 |   if ((*(int*)a==0)||(*(int*)b==0))
  19 |   {
  20 |   return +1;
  21 |   }
  22 |   else
  23 |   {
  24 |   return ( *(int*)a - *(int*)b );
  25 |   }
  26 | }
  27 | 
  28 |