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)
>Solution :
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