This is the solution of Programming Pearls in column 1.6_1:
> #include <stdio.h>
int intcomp(int *x, int *y)
{
return *x-*y;
}
int a[1000000];
int main(void) {
// insert code here...
int i,n=0;
while (scanf("%d",&a[n])!=EOF) {
n++;
}
qsort(a,n,sizeof(a[0]),intcomp);
for(i=0;i<n;i++)
{
printf("%d\n",a[i]);
}
return 0;
}
Error message:
conflicting types for "qsort"
Can you tell me why could that happen? Isn't it defined by default?
My compiler is Xcode (MacOS).