line 15:type mismatch in redclaration of 'merge'
#include<stdio.h>
#include<conio.h>
void mergeSort(int x[],int lb,int ub)
{
int m;
if(lb<ub)
{
m=(lb+ub)/2;
mergesort(x,lb,m);
mergesort(x,m+1,ub);
merge(x,lb,m,ub);
}
}
void merge(int x[],int lb,int m,int ub)
{
int temp[20],i,j,k;
k=0;
i=lb;
j=m+1;
while(i<=m && j<=ub)
{
if(x[i]<x[j])
temp[k++]=x[i++];
else temp[k++]=x[j++];
}
while(i<=m)
temp[k++]=x[i++];
while(j<=ub)
temp[k++]=x[j++];
k=0;
for(i=lb;i<=ub;i++)
x[i]=temp[k++];
}
void main( )
{
int x[20],i,n;
printf("Enter the total number of elements: \n");
scanf("%d",&n);
printf("Enter the elements which to be sorted: \n");
for(i=0;i<n;i++)
scanf("%d",&x[i]);
mergesort(x,0,n-1);
printf("After merge sorting elements are:\n");
for(i=0;i<n;i++)
printf("%d ",x[i]);
getch();
}