Cleaner way to handle double pointer in C++ BST?
If you're trying to learn C++, you should get comfortable with constructors and destructors — they're what C++ is all about!

struct Node 
{ 
    int data; 
    Node *left, *right; 
}; 

// A utility function to create a new BST node 
Node* newNode(int data) 
{ 
    Node *temp =  new Node(); 
    temp-&gt;data = data; 
    temp-&gt;left = NULL; 
    temp-&gt;right = NULL; 
    return temp; 
}


That's C style. C++ style would be:

struct Node { 
    int data_; 
    Node *left_ = nullptr;
    Node *right_ = nullptr;

    explicit Node(int data) : data_(data) {}
}; 


Then when you want a new heap-allocated node, you don't call newNode(42) — you call new Node(42)! Or, a good habit you should get into: call std::make_unique&lt;Node&gt;(42) to get back a smart pointer.

Notice that I added sigils to your data members (data_ etc) to distinguish them from non-member variables; and I declared no more than one variable per line to reduce reader confusion.



void inorder(Node *&amp;root) 
{ 
    if (root != NULL) 
    { 
        inorder(((root)-&gt;left)); 
        printf("%d \n", (root)-&gt;data); 
        inorder(((root)-&gt;right)); 
    } 
}


Several things weird here. First, you have a bunch of unnecessary parentheses. (root) is the same thing as root. Second, you're passing root by non-const reference, even though you don't intend to modify it. Third, very minor nit, you're using C-style NULL instead of nullptr. Fourth, why do you print a space before the newline? Fixed up:

void inorder(const Node *root)
{
    if (root != nullptr) {
        inorder(root-&gt;left); 
        printf("%d\n", root-&gt;data); 
        inorder(root-&gt;right); 
    } 
}


Remember to remove the redundant parentheses in places like insert(((node)-&gt;right),value). It's much easier to read as insert(node-&gt;right, value).