But isn't this a post-operative bypass of exactly what you are doing? Assuming both left and right are both non-zero, first do height(left), then height(right), and then some processing on the current node. This postoperative bypass is for me.
But I would write it as follows:
int Tree::height(tree *node) {
if (!node) return -1;
return 1 + max(height(node->left), height(node->right));
}
: , , ( ) 0 -1.