program in C, shell sort.
i've got this error : sort.c(13) : error C2371: 'shellSort' : redefinition; different basic types
i've got this error : sort.c(13) : error C2371: 'shellSort' : redefinition; different basic types
Code:
#include <stdio.h>
int a[6] = {5, 9 , 2, 8, 7, 1};
int main(){
int m;
m = 0;
shellSort(a, 6);
for(m = 0; m<20; m++)
printf("\n%d", a[m]);
return 0;
}
void shellSort( int a[],int N){
int i, j, inc;
int tmp;
for(inc = N/2; inc>0; inc /= 2)
for(i = inc; i < N; i ++)
{
tmp = a[i];
for(j = i; j>= inc; j -= inc)
if(tmp <a[j-inc])
a[j] = a[j - inc];
else
break;
a[j] = tmp;
}
}
Comment