I am implementing a Binary Search Tree. And it so happens one of my sources have a function written such that:

Node * BST_Insert(Node *root, int val)
{
//Body 
}

I already know that a pointer is a variable which contains the address of another variable and we can't assign a value to a pointer, but we can assign the address of another variable to the pointer.

My Question is what the pointers on this prototype do exactly?

Node * BST_Insert(Node *root,int val) 

Node is most likely a typedef of a structure representing a node in the Binary Search Tree.

Thus Node *root represents a pointer to the root of the BST, i.e. a handle to the tree structure.

Since insertion of a new node may change which node is the root of the tree, the function most likely returns a pointer to the new root node.


The Pointer is pointing at the address of the returned data, In this case your function returns a Node data type. For example if your function was returning an array you can declare it as Function Pointer to have access to the address of the returned array