Skip to content

Instantly share code, notes, and snippets.

@eduardoaugustojulio
Created November 8, 2016 04:16
Show Gist options
  • Save eduardoaugustojulio/5afaa3d0892d26af2864714ee2a7b3f9 to your computer and use it in GitHub Desktop.
Save eduardoaugustojulio/5afaa3d0892d26af2864714ee2a7b3f9 to your computer and use it in GitHub Desktop.
quicksort c
#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;
}
@eduardoaugustojulio
Copy link
Author

simple qsort demonstration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment