When the bottom most left child is passed as root, it is not null.
void inOrder(struct node* r)
{
if (r==NULL)
return;
else{
inOrder(r->left);
printf("%d ", r->value);
inOrder(r->right);
}
}
In your above code when you pass the bottom most left child as root.
It first executes this line
if (r==NULL) return;
as r is not null currently it will skip this return.
In the else part it would now execute
else{
inOrder(r->left);
Here, It is calling the same function again so, the current execution will pause for a moment and resume when this call returns.
Now, inOrder(r->left); call inOrder(struct node* r); again with null as parameter r to this call. since, you are passing r->left which is null.
so, this call to inorder will hit return
if (r==NULL) return;
As it returns it will resume last instance of inorder call which paused at
inOrder(r->left); call.
This is possible because whenever you call a function from inside a
function is maintains a call stack.
Now, after resuming it will execute the next line
printf("%d ", r->value);
Which will print the value in your bottom left most node.
finally, it will call the last line
inOrder(r->right); which will again pause the execution of current function and after saving the current state of function in call stack it will call the inorder with null again r->right which will return again from
if (r==NULL) return;
and finally it will come back to original execution of inorder and resume and as there are no instruction left it will return to the main method if you called from there and resume what left in main.
so, your answer is it will print only the value in the bottom most left node.