struct _tree { char *word; int count; struct _tree *left; struct _tree *right; }; void treeprint(struct _tree *node) { static int depth = 0; if(node) printf("\nLevel %d: %d occurrences of %s", depth,node->count,node->word); depth++; treeprint(node->left); treeprint(node->right); depth--; }