有错误,无法运行,请帮忙检查错误
#include "stdio.h"#include "stdlib.h"
#define MAXSIZE 215
typedef int Status;
typedef char TElemType;
typedef struct bitree
{
TElemType data;
struct bitree *lchild,*rchild;
}BiTNode, *BiTree;
BiTree Create_Tree()
{
BiTree T;
char a;
scanf("%s",&a);
if(a=='#')
T=NULL;
else
{
T= (BiTNode*) malloc (sizeof(BiTNode));
T->data = a;
printf("输入左孩子的值\n");
T->lchild = Create_Tree();
printf("输入右孩子的值\n");
T->rchild = Create_Tree();
}
return T;
}
void PreorderTraverse(Bitree T)
{
sqstack s;
Empty(&s)
Push(&s,root);
Pop(&s,b);
Bitree p,b;
Inintstack(&s);
while(Empty(&s))
{
if(root==NULL)printf("树为空树\n");
while(Gettop(s,&p)&&p){printf("%c",p->data);Push(&s,p->Lchild);}
Pop(&s,b);
if(Empty(&s)){Pop(&s,b);Push(&s,b->Rchild);}
}
}
void InOrderTraverse(BiTree T)
{
if(T!=NULL)
{
InOrderTraverse(T->lchild);
printf("%c_ ",T->data);
InOrderTraverse(T->rchild);
}
}
void PostOrderTraverse(BiTree T)
{
if(T!=NULL)
{
PostOrderTraverse(T->lchild);
PostOrderTraverse(T->rchild);
printf("%c_ ",T->data);
}
}
void LevelOrder(BiTNode *bt) /*层次遍历二叉树bt*/
{
BiTNode* queue[MAXSIZE];
int front,rear;
if (bt==NULL)
return;
front=0; /*非循环队列*/
rear=0;
queue[rear++]=bt;
while(front!=rear)
{
printf("%c_",queue[front]->data); /*访问队首结点的数据域*/
if (queue[front]->lchild!=NULL) /*将队首结点的左孩子指针入队列*/
{
queue[rear]=queue[front]->lchild;
rear++;
}
if (queue[front]->rchild!=NULL) /*将队首结点的右孩子指针入队列*/
{
queue[rear]=queue[front]->rchild; rear++;
}
front++;
} /* while */
}/* LevelOrder*/
int main()
{
BiTree root;
root=Create_Tree();
printf("\n先序遍历");
PreOrderTraverse(root);
printf("\n中序遍历");
InOrderTraverse(root);
printf("\n后序遍历");
PostOrderTraverse(root);
printf("\n层次遍历");
LevelOrder(root);
printf("\n");
}
有错误,无法运行,求改正