Skip to content

Instantly share code, notes, and snippets.

@lucansky
Created March 28, 2015 23:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucansky/f12fa8ad311a83a4a0c8 to your computer and use it in GitHub Desktop.
Save lucansky/f12fa8ad311a83a4a0c8 to your computer and use it in GitHub Desktop.
Quicksort C example
#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