Run ❯
Get your
own
website
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Go to Spaces
Ctrl+Alt+P
#include
#include
// Tells qsort() how to compare two numbers int compare(const void *a, const void *b) { return (*(int*)a - *(int*)b); } int main() { int numbers[] = {64, 25, 12, 22, 11}; int length = sizeof(numbers) / sizeof(numbers[0]); qsort(numbers, length, sizeof(int), compare); for (int i = 0; i < length; i++) { printf("%d ", numbers[i]); } printf("\n"); return 0; }
11 12 22 25 64