二叉树的建立为什么编译没有错误,但是不出结果?

#include <iostream>
using namespace std;
typedef struct bitree
{
char data;
bitree * lchild;
bitree * rchild;
}bitree;
void create(bitree *root)
{
char ch;
cin>>ch;
if(ch=='.') root=NULL;
else
{
bitree *root=new bitree;
root->data=ch;
create(root->lchild);
create(root->rchild);
}
}
void preorder(bitree *root)
{
if(root!=NULL)
{
cout<<root->data;
preorder(root->lchild);
preorder(root->rchild);
}
}

int main()
{
bitree * root;
create(root);
preorder(root);
prebitree(root);
return 0;
}

bitree *root=new bitree 可以有问题,它又声明了一个新局部变量
另外只有内存申请,没有释放,有可能会有问题
还有prebitree定义在哪里
温馨提示:答案为网友推荐,仅供参考
相似回答