There is nothing wrong with doing it this way. In fact, it allows you to pass extra arguments to the recursive function, for example if you wanted to say control how the recursion is done. It is also common to make the recursive function only visible in the current compilation unit:
Code:
static void recurse(const node *const node, const int direction)
{
if (direction > 0 && node->left)
recurse(node->left, direction);
else
if (direction < 0 && node->right)
recurse(node->right, direction);
/* Do this node */
if (direction > 0 && node->right)
recurse(node->right, direction);
else
if (direction < 0 && node->left)
recurse(node->left, direction);
}
void inorder_ascending(const b_s_tree *const tree)
{
if (tree && tree->root)
recurse(tree->root, +1);
}
void inorder_descending(const b_s_tree *const tree)
{
if (tree && tree->root)
recurse(tree->root, -1);
}
Note that the recurse() function above is not intended to be called directly by "user" code, only by the inorder_foo() functions. This way you can very easily add instrumentation -- for example, like I showed earlier, printing the entire tree in DOT format for detailed examination of the tree and the traversal process -- without having to modify any code that calls the inorder_foo() functions.