二叉树求高度无输出问题

int treeheight(BiTree root)
{int lheight=0;
int rheight=0;
if(root==NULL)
    return 0;
else
{      lheight=treeheight(root->lchild);
       rheight=treeheight(root->rchild);
    if(lheight>rheight)
    return (lheight+1);
    else
        return (rheight+1);

}
}

-

case 2:printf("树的高度为:");
                   treeheight(roots);
                   printf("\n");
                   break;

img

treeheight(roots);
printf("\n");
改为
printf("%d\n",treeheight(roots));

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^