void outbef(Bnode *T)
{
void createtree(Bnode *T);
if(T==NULL)
{
printf("error:空数组!请重新输入!\n");
createtree(T);
}
printf("%c\t",T->data);
if(T->lchild!=NULL) outbef(T->lchild);
if(T->rchild!=NULL) outbef(T->rchild);
printf("\n");
}
为什么把建树写在遍历里面?
void outbef(Bnode *T)
{
if(T==NULL)
{
printf("error:空数组!请重新输入!\n");
}
else
{
printf("%c\t",T->data);
outbef(T->lchild);
outbef(T->rchild);
printf("\n");
}
}
试试这个
可能又子树是个NULL。。。。。。。。。。。。。。