Why is a node returned in the insertInBST function?

Why is a node returned in the insertInBST function and why can’t be just update the values at the address of the node??

hi @mehulbhandari358

returning node address is very important because it reflect the changes done in insertInBST() to the main and also update left and right of each node

in insertInBST()
we write
root->left=insertInBST(root->left,data);
if don’t return node adddress then how a new node is attached??

i hope this help
if you have more doubts regarding this feel free to ask
if your doubt is resolved mark it as resolved from your doubt section inside your course