#include <stdio.h>
int main()
{
int sort(int);
int a[11] = {1, 4, 6, 8, 0, 9, 7, 5, 2, 3};
sort(a);
}
int sort(int *a)
{
int i,j, k, temp;
for (j = 2; j < 10; j++)
{
for (k = 0; k < j; k++)
{
if (a[j] < a[k])
{
temp = a[k];
a[k] = a[j];
a[j] = temp;
}
}
}
for (i = 0; i < 10; i++)
{
printf ("%d ", a[i]);
}
}
On compilation:
qwerty@qwerty-workstation:~$ cc Insertion.c
Insertion.c: In function main:
Insertion.c:6: warning: passing argument 1 of sort makes integer from pointer without a cast
Insertion.c: At top level:
Insertion.c:9: error: conflicting types for sort
Insertion.c:4: error: previous declaration of sort was here