Whats the error in the code below?
Code:
#include <stdio.h>
#include <stdlib.h>
#define MAX 3
int intcmp(const void *v1, const void *v2);
main()
{
int i, arr[MAX];
//Asks the user to input three interger numbers
printf("Enter %d integer values; press Enter after each.\n", MAX);
for (i = 0; i < MAX; i++)
scanf("%d", &arr[i]);
//Sort the array into ascending order.
qsort(arr, MAX, sizeof(arr[1]), intcmp);
//Display the sorted array.
for (i = 0; i < MAX; i++)
printf("\n%d", i, arr[i]);
}
int intcmp(const void *v1, const void *v2)
{
int cmpvalue1, cmpvalue2;
cmpvalue1 = *(int*)v1;
cmpvalue2 = *(int*)v2;
return cmpvalue1 - cmpvalue2;
}