I’ve been trying to implement a bst, in C. I think I’m almost there, but in my add node function, I create a temporary node called current to store the current node which is visited in the tree. Then when I modify the current node, my orignal pointer is not modified after the function finishes.
I’ve read up about this, and I think I may need a pointer of a pointer, but I stil don’t quite know how to updated original struct.
You are right that the problem has to do with the pointer to a pointer in
bstlist_add. Here’s an example that should help you figure out what you need to change in your code.