Salve ragazzi ho il seguente typedef:
Ed ho la seguente function:codice:typedef struct heap { int Dim; int MaxDim; void *Link; int Size; } HEAP;
Il compilatore, quando vado a compilare, mi dà il seguente errore: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); }
codice:incompatible type for argument 2 of `Swap'L'errore è dato dalla riga in grassetto.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); } }

Rispondi quotando