in the above code when the last element is reached i.e r->left becomes null
then when inorder(r->left) is called it will send a null value to the function
and if condition becomes false so the it'll come out of the function.
But the problem is that instead of coming out of the loop it executes the
printf("\t %d",r->data); statement when it comes to the last element.
Please explain me(if you don't understand the question plz read it twice i need your help)