Created
November 8, 2016 04:16
-
-
Save eduardoaugustojulio/5afaa3d0892d26af2864714ee2a7b3f9 to your computer and use it in GitHub Desktop.
quicksort c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int compare_int(const void * a, const void *b) | |
{ | |
return ( *(int*)a - *(int*)b ); | |
} | |
int var_list[] = {3,8,1,4,6,0,88}; | |
int main() | |
{ | |
qsort (var_list, (sizeof(var_list)/sizeof(int)), sizeof(int), compare_int); | |
for (int i=0; i < (sizeof(var_list)/sizeof(int)); i++) | |
printf ("%d, ",var_list[i]); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
simple qsort demonstration.