二叉树遍历运行出错了求助
typedef char elemtype;typedef void status;
#include"data1.h"
#include"iostream.h"
#include"stdlib.h"
struct bitree{
elemtype data;
struct bitree *lchild;
struct bitree *rchild;
};
status preorder(struct bitree *bt)
{if(bt!=NULL)
{cout<<bt->data<<' ';
preorder(bt->lchild );
preorder(bt->rchild );
}
}
status inorder (struct bitree *bt)
{if(bt!=NULL)
{inorder(bt->lchild );
cout<<bt->data<<' ';
inorder(bt->rchild);
}
}
status postorder(struct bitree * bt)
{if(bt!=NULL)
{postorder(bt->lchild );
postorder(bt->rchild );
cout<<bt->data <<' ';
}
}
status createbitree(struct bitree *bt)
{char ch;
cin>>ch;
if(ch=='#')
bt=NULL;
else
{bt=(struct bitree*)malloc(sizeof(struct bitree));
bt->data=ch;
createbitree(bt->lchild );
createbitree(bt->rchild );
}
}
#include"data2.h"
#include"data1.h"
#include"iostream.h"
void main()
{struct bitree *bt;
createbitree(bt);
postorder( bt);
}