Recursion

This is a discussion on Recursion within the C++ Programming forums, part of the General Programming Boards category; I'm trying to get my binary tree to print out 10 things per line. I'm having issues though, as when ...

Recursion

I'm trying to get my binary tree to print out 10 things per line. I'm having issues though, as when the traversing reaches a leaf, on moving to the next printable node my counter is reset to one more than that node's parent, which isn't what I want. I'm not sure how to correct this?

So when the first recursive call to preorder is made, that call and all its sub-calls alter their local copy of the numprint variable. Then after they return you pass the same value that you passed to that recursive call into the second recursive call.

Two obvious solutions come to mind, both involve changing the function signature in some way.