#include #include int comparator(const void *p, const void *q) { int l = *((int *)p); int r = *((int*)q); return (l - r); } int main(void) { srand(100); int lst[1000]; for (int i=0; i<1000; i++) { lst[i] = rand()%10000; } for (int i=0; i<10; i++) printf("B %d\n", lst[i]); qsort(lst, 1000, sizeof(int), comparator); for (int i=0; i<10; i++) printf("A %d\n", lst[i]); }