请各位看一下关于二叉树的程序出了什么错误?
#include <stdio.h>#include <malloc.h>
#define MAXSIZE 20
typedef struct btnode
{
char cdata;
struct btnode *lchild,*rchild;
}BTNode;
BTNode *Create_BiTree()/*二叉树的建立*/
{ /*用辅助数组建立二叉树*/
int i,j;
char ch;
BTNode *s,*t,*p[MAXSIZE];
printf("输入顶点编号及信息,输入0和#结束:i,ch");
scanf("%d,%c",&i,&ch);
while(i!=0 &&ch!='#')/*建立二叉树的存储结构*/
{s=(BTNode *)malloc(sizeof(BTNode));
s->cdata=ch;
s->lchild=s->rchild=NULL;
p[i]=s;
if(i==1) t=s;/*判断输入结点是根结点、左孩子还是右孩子*/
else
{j=i/2;
if(i%2==0) p[j]->lchild=s;
else p[j]->rchild=s;
}
printf("输入顶点编号及信息,输入0和#结束:i,ch");
scanf("%d,%c",&i,&ch);
}
return t;
}/* Create_BiTree1*/
void Preorder(BTNode *bt)
{/*前序递归遍历*/
if(bt)
{
printf("%c",bt->cdata);
Preorder(bt->lchild);
Preorder(bt->rchild);
}
}/* Preorder*/
void main()
{
BTNode *g;
Create_BiTree(&g);
Preorder(g);
}