I have a pointer that points to an array of pointers(char **pp). The array of pointers that "pp" points to, points to sections of a string. I want to move the address's that the pointers point to in a string to make room for a new pointer.
Here is my formula using memcpy to copy data.
memcpy(pp + (sizeof(char *) * (Index+1)), pp+(sizeof(char *) * Index), (pplen - Index) * sizeof(char *));
"Index" is an int of where to add the new pointer in memory. This is sopposed to copy data from one spot to another which will make room for a new element in the correct spot for fast searching. The problem is it doesn't work properly. Everything is ok if The corect spot to put the new pointer is at the end because that does not require memcpy. But if it requires to use memcpy or memmove to move data to make room for a new pointer it all messes up.
I get no errors from that line. But because something is wrong in my formula I get errors when searching. How can I move a memory block of pointers to a new location?
Thanx in advance!