Created
February 2, 2015 11:57
-
-
Save akerenyi/ea8332b5398d1f9692bb to your computer and use it in GitHub Desktop.
Quick sort in 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> | |
#define SIZE 10 | |
// function needed for quick sort | |
int compare(const void *a, const void *b); | |
int main() { | |
int numbers[SIZE]; | |
/* Sort the array */ | |
qsort(numbers,SIZE,sizeof(int),compare); | |
return(0); | |
} | |
int compare(const void *a, const void *b) { | |
return( *(int *)a - *(int *)b ); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment