BST to sorted LL

I am getting output only till 1–>3 from my code i dont know why and when im running in coding blocks ide i get the warning

Output
source.cpp: In function ‘node* insertInBST(node*, int)’:
source.cpp:31:1: warning: control reaches end of non-void function [-Wreturn-type]
31 | }
| ^

Hello @aryamaan1011,

You are getting this warning because the function: node* insertInBST(node*, int) has a return type but you are ending the loop without returning anything.

Missing statement:
return root;

Hope, this would help.
Give a like if you are satisfied.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.