Binary Search Tree Node Removal

I am sharing my code for removing any node at any position in a given Binary Search Tree. My doubt is that if we reach such a condition when we have traversed the whole tree but we can’t find the node that has to be removed. So the node becomes null now and that becomes the base condition. So when node==null then why do we write"return" and why cant we give the printing statement wriiten in my code. https://ide.codingblocks.com/s/204232
Also I am not able to understand why my entire code is not getting uploaded after 167 lines?? at coding blocks ide

hi @hira
when we didn’t find the node to be deleted we hit the base condition and return from there inorder to prevent us null pointer exception .

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.