So I'm trying to insert a value into a binary tree using this recursive function:
void add(node* *hd, int v){
node* curr = *hd;
if(curr == NULL){
curr = (node*)malloc(sizeof(node));
curr->value = v;
}else{
if(v < curr->value){
add(&curr->left, v);
}else{
add(&curr->right, v);
}
}
}
It doesn't seem to be working, and I just don't understand why I can't do something like this. How would I go about fixing it?