I don't know why, but my remove function doesn't seem to operate properly. The rest of my code is fine, so I am trying to pinpoint the exact location of my error. The else if statement remove(root->left, data) should've been called twice, but it only called once. Is anyone able to assist me
If line 18 executes, what happens on line 37? Your root no longer points to a valid object, so root->data is undefined behavior.
If line 23 executes and root->right has children, what happens to those children? Do previous pointers to the deleted node still point to the invalid node?
If line 28 executes and root->left has children, what happens to those children? Do previous pointers to the deleted node still point to the invalid node?
Ok I think I see what you're saying. On line 35, I should return root, so that if I just delete the root, I would return Null as the value that is being removed.