Below is an example of the application of the qsort
function, using a compare
function:
#include <iostream>
#include <cstdlib>
#include <climits>
using namespace std;
int compare (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
int main()
{
int vet[]={3,2,1};
qsort(vet,3,sizeof(int),compare);
for(int i=0;i<3;i++)
cout<<endl<<vet[i];
}
compare
? void
arguments of this function?