#include<stdio.h> #include<gsl/gsl_sort_int.h> #include<gsl/gsl_heapsort.h> int input[20],output[20]; int compare(const int * a, const int * b) { if (*a > *b) return 1; else if (*a < *b) return -1; else return 0; } int main(){ int i; printf("숫자 10개를 입력하시오:"); for(i=0;i<10;i++){ scanf("%d",&input[i]); } gsl_heapsort(*input,10, sizeof(int),compare); gsl_sort_int_smallest (output, 5, input, 1, 10); printf("sort 결과 중 작은 5개:%d %d %d %d %d",output[1],output[2],output[3],output[4],output[5]); printf("입력 숫자 중 작은 5개:%d %d %d %d %d",gsl_sort_int_smallest()); }