Salve ragazzi ho il seguente typedef:
codice:
typedef struct heap
{
int Dim;
int MaxDim;
void *Link;
int Size;
} HEAP;
Ed ho la seguente function:
codice:
void Swap(void *a, void *b, int dim)
{
void *temp = malloc(dim);
memcpy(temp, a, dim);
memcpy(a, b, dim);
memcpy(b, temp, dim);
free(temp);
}
Il compilatore, quando vado a compilare, mi dà il seguente errore:
codice:
incompatible type for argument 2 of `Swap'
codice:
void Heapfy(HEAP *Heap, int i, COMPARE Compare)
{
int l;
int r;
int max;
l = Sinistro(i);
r = Destro(i);
if ( l <= Heap->Dim && Compare( ((Heap->Link)+l*Heap->Size),((Heap->Link)+i*Heap->Size)) > 0 )
max = l;
else
max = i;
if ( r <= Heap->Dim && Compare( ((Heap->Link)+r*Heap->Size), ((Heap->Link)+max*Heap->Size)) > 0 )
max = r;
if ( max != i )
{
Swap( Heap, Heap[max], 4 );
Heapfy(Heap, max, Compare);
}
}
L'errore è dato dalla riga in grassetto.