The code seems to work fine but something wrong with the output.
link:https://ide.codingblocks.com/s/107375
Failed Testcase
@singhraghu2751
You should only check if the data is in between the range when you are printing it.
If you check before as you have , your code will give wrong answers since it is possible that the node in the given range might be larger than b , but its left child might be a viable candidate for printing. Since your code returns from there only without making a recursive call for left child , you miss out on several nodes.