That printPreorder will return to main() just like you wrote. But remember, a recursion function uses the function call stack to repeat itself.after then the statement printPreorder(node->left) will cause the condition node==null to go true...so after then what happens so that the function prints the leftover nodes in the tree of the above example?? Please help.
So you made a stack of function calls:
printPostorder(root); /* from main() - 1 */
printPostorder(node->left); /* 2 */
printPostorder(node->left); /* 4 */
The call in the stack that will eventually print 4 calls again to end that side of the tree, and then you have to start on the right side since it is the next recursive call.
printPostorder(node->right); /* right of 4 - null */
printPostorder(node->right); /* right of 2 - node 5 */
printPostorder(node->right); /* right of 1 - node 3 */
That done, you start printing values to unwind the entire stack.
3
5
4
2
1
I'm pretty sure that the order is that...
Anyway, trace the recursion yourself to prove it.