I'm implementing a heapsort on a void array. But I'm having trouble with line 6:
void siftdown(char *start, char *end, size_t size)
{
char *curr = start;
char *child;
while (curr*2 + size <= end)
I cast the pointers to char because they have a length of one, and I multiply the index i want by the size of the data to shift to the right position. For example:
char *pos = (char *)arr + 5*size
will shift me to index 5.
I want to reference twice the current position in the array + 1. I know I can't multiply the pointer by 2, but how might I do this?