Question on Pointer Arithmetic
- by pws5068
Heyy Everybody!
I am trying to create a memory management system, so that a user can call myMalloc, a method I created. I have a linked list keeping track of my free memory. My problem is when I am attempting to find the end of a free bit in my linked list. I am attempting to add the size of the memory free in that section (which is in the linked list) to the pointer to the front of the free space, like this.
void *tailEnd = previousPlace->head_ptr + ((previousPlace->size+1)*(sizeof(int));
I was hoping that this would give me a pointer to the end of that segment. However, I keep getting the warning:
"pointer of type 'void*' used in arithmetic"
Is there a better way of doing this? Thanks!