Created
March 28, 2015 23:40
-
-
Save lucansky/f12fa8ad311a83a4a0c8 to your computer and use it in GitHub Desktop.
Quicksort C example
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> | |
#include <string.h> | |
static int cmp(const void *str1, const void *str2) { | |
return strcmp((char*) str1, (char*)str2); | |
} | |
int main() { | |
char mena[3][10] = {"sadfdsafv", "greqplkxn", "pwoikjhsq"}; | |
qsort(mena, 3, 10, cmp); | |
for(int i = 0; i < 3; i++) { | |
printf("%d : %s\n", i, mena[i]); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment