Removing a pointer from an array of pointers
I am creating a tree data structure in which I have an array of pointers at each node (
) that points to children (array size is fixed):
I want to have a child inside a variable
(without freeing the memory associated with it), but I also want to remove the reference between the parent and the children. Am I doing it right?
node* child = NULL; i=2; child = parent->children[i]; parent->children[i] = NULL;
source to share