pointers - Debug error, Heap Corruption? -
] i'm trying free dynamic array , error:
heap corruption detected: after normal block (#65) @ 0x00abd260. crt detected application wrote memory after end of heap buffer.
void mergesort(monom *data,unsigned int size) { monom *temp = 0; unsigned int i; if (size == 1) { return; } else { mergesort(data, (size / 2)); mergesort(data + size / 2, size - size / 2); temp = (monom*)malloc(size * sizeof(monom*)); if (temp == null) { exit(1); } sortedmerge(data, data + size / 2, size / 2, size - size / 2, temp); (i = 0; < size; i++) { data[i] = temp[i]; } free(temp); } }
what's wrong it?. thank you!.
Comments
Post a Comment