Hello,
I am trying to use the qsort function but i get an error :
error : expected expression before 'int' on the line where i call the qsort function
Code:
int compare(int *a, int *b);
void schrijfUit (int array[]);
int main (void){
int array[10] = {1, 5, 23, 43, 3, 3, 543, 2, 542, 53};
schrijfUit(array);
qsort(array,10,sizeof(int),int compare (int *a, int *b));
schrijfUit(array);
return 0;
}
void schrijfUit (int array[]){
int i;
for (i = 0; i < 10; i++)
printf("%i\t", array[i]);
printf("\n");
}
int compare(int *a,int *b) {
if (*a==*b)
return 0;
else{
if (*a < *b)
return -1;
else
return 1;
}
}
I think it is a very stupid mistake but i cant see it.