This function should return the pointer to the node with value of key, but instead loops over the values until it reaches the value of they key, and returns NULL instead. I'm not sure why.
BST_Node *BST_search(BST_Node *root, int bar, double index){
if (root==NULL){
return root;
}
double queryKey=(10.0*bar)+index;
if (queryKey==((10.0*root->bar)+root->index)){
return root;
}
if (queryKey<((10.0*root->bar)+root->index)){
return BST_search(root->left, bar, index);
}
else if (queryKey>((10.0*root->bar)+root->index)){
return BST_search(root->right, bar, index);
}
}
Thanks for your help.