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 ( node* children[FIXED_SIZE]
) that points to children (array size is fixed):
I want to have a child inside a variable child
(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;
+3
source to share