Created
February 21, 2011 18:40
-
-
Save catphive/837493 to your computer and use it in GitHub Desktop.
example of a GNU C program that needs an executable stack
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 <stdlib.h> | |
#include <stdio.h> | |
int main() { | |
int count = 0; | |
int compar(const void *left_ptr, const void *right_ptr) { | |
int left = *(int*)left_ptr; | |
int right = *(int*)right_ptr; | |
++count; | |
return left - right; | |
} | |
int array[] = {8, 2, 4, 2, 7}; | |
qsort(array, sizeof array / sizeof(int), sizeof(int), compar); | |
int ii; | |
for(ii = 0; ii < sizeof array / sizeof(int); ++ii) { | |
printf("%d ", array[ii]); | |
} | |
printf("\n"); | |
printf("count: %d\n", count); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment