OK, thanks, but if I change it to this:
Code:
//Copy the entire node as a block of memory into the new position
node = (TreeNode *) memmove(destination, node, sizeof(TreeNode));
//The destination pointer is no longer valid
free(destination);
destination = NULL;
Then surely the "free" statement would free the block of memory pointed to by "destination", which is now the new block of memory? Could I instead use this?:
Code:
//Free the destination block of memory
free(destination);
//Copy the entire node as a block of memory into the new position
node = (TreeNode *) memmove(destination, node, sizeof(TreeNode));
//The destination pointer is no longer valid
destination = NULL;
This frees the destination block of memory beforehand, but would this then affect the subsequent "memmove" statement? Does calling "free(destination)" keep "destination" as a valid pointer that can be used in memmove?
Sorry about all the questions, I'm new to this