borre una parte pequeña que me parece no afectaba el funcionamiento y agrege el codigo que me dices me envia el siguiente error
merge_dec2.c: In function ‘main’:
merge_dec2.c:67: warning: format ‘%i’ expects type ‘int’, but argument 3 has type ‘void *’
Código C:
Ver original#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<string.h>
void merge(int *a, int l, int r, int n)
{
int n1 = n-l+1, n2 = r-n, i,j,k;
int b[n-l+2], c[r-n+1];
int t;
b[n1] = c[n2] = 2147483647;
for(i=0;i<n1;i++) b[i] = a[l+i];
for(i=0;i<n2;i++) c[i] = a[n+1+i];
i = j = 0;
for(k=l;k<=r;k++){
if (b[i] <= c[j])
a[k] = b[i++];
else
a[k] = c[j++];
}
return ;
}
void *mergesort(int a[], int low, int high)
{
int mid;
if(low<high)
{
mid=(low+high)/2;
mergesort(a,low,mid);
mergesort(a,mid+1,high);
merge(a,low,high,mid);
}
if(high==low)
{
return a;
}
return(0);
}
int main ()
{
float total,inicio, final;
FILE *ofp, *ifp;
ifp
= fopen("aleatorio.txt","r"); int N, i;
int d[N];
int *j;
for(i=0;i<N;i++)
{
}
ofp
= fopen("merge_dec.txt","w");
for(i=0;i<N;i++)
{
fprintf(ofp
,"%i\n",mergesort
(d
,0,N
)); }
total=(final-inicio)/(double) CLOCKS_PER_SEC;
return 0;
}