bool search(double x, TreeNode *t)
{
if (t->value == x)
return true;
else if (x < t->value)
search(x, t->left);
else if (x > t->value)
search(x, t->right);
return false;
bool search(double num)
{
TreeNode *ptr = root;
return search(num, ptr);
}
The search function with 2 arguments is a private member function of a binary tree class that uses recursion to search for a value. The other search function is called to call the recursive function. This code does not work. I have displayed the value of the recursive function and it does not return 0 or 1. I have no idea why. Also, if I send in a value that is not in the tree, the program crashes so I get no errors to help me.