/tmp>cat testing.c #include #include static inline int compare_short(const void * a, const void * b) { if (*(short *)a < *(short *)b) return -1; if (*(short *)a > *(short *)b) return 1; return 0; } static inline int compare_int(const void * a, const void * b) { if (*(int *)a < *(int *)b) return -1; if (*(int *)a > *(int *)b) return 1; return 0; } static int foo[5]={47,11,0,8,15}; int main(int argc, char ** argv) { qsort(foo,sizeof(foo)/sizeof(foo[0]),sizeof(foo[0]),&compare_int); } /tmp>CFLAGS="-Wall -pedantic" make testing cc -Wall -pedantic testing.c -o testing /tmp>cc --version cc (GCC) 5.3.0 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. /tmp>