pointer to pointer as argument question
If I have a function, such as a delete function for a binary search tree, and I want to change the root node, which is a pointer within main(), The only way I read I could do that would be to pass a pointer to that pointer.
void someFunc(node **root, int key);
I am a little confused in how this should be used. I keep getting "Request for member in something not structure or union" with the following.
Any help on getting these pointers set right would be appreciated.
void delete(b_tree **tree, t_node *node, int key)
//code in here
if(target == tree->root)
tree->root = tmp; //i think it should be *tree->root
EDIT: I initially thought this would work....
if (target == *tree->root)
*tree->root = tmp;