Hi, I have this simple code for B-Tree but when I add a new item in debugging I notice when I get out of the add function the root is still null and no node added to it!

this the main function:
int main()
{
    Node *root = nullptr;
    int num;

    do
    {
        std::cout << "Add a new item: ";
        std::cin >> num;
        add(root, num);
    } while (num != 0);

and this is the add function:
void add(Node *r, int value)
{
    Node *n = new Node;
    Node *tmp = r;
    if (r == NULL)
    {
        n->data = value;
        n->left = n->right = NULL;
        r = n;
        return;
    }
}