帮忙修改一下,哪错了
#include <stdio.h>
#include <malloc.h>
# define null 0
# define maxsize 100
typedef struct node
{
char data;
struct node *lchild, *rchild;
}node, *bitree;
bitree Q[maxsize];
bitree creat()
{
char ch;
int front,rear;
bitree root,s;
root = null;
front = 1;
rear = 0;
ch = getchar();
while (ch != '#')
{
s = null;
if (ch != '@')
{
s = (bitree)malloc(sizeof(node));
s->data = ch;
s->lchild = null;
s->rchild = null;
}
rear++;
Q[rear] = s;
if (rear == 1)
{
root = s;
}
else
{
if(s && Q[front])
if (rear%2 == 0)
{
Q[front]->lchild = s;
}
else
{
Q[front] ->rchild = s;
}
if (rear%2 == 1)
{
front++;
}
}
ch = getchar();
}
return root;
}
void Porderf(bitree root)
{int top=0; bitree p, s[100];
p=root;
while (p||top)
{while (p!=null)
printf("%d\t",p->data);
{s[top++]=p;
p=p->lchild;
}
if(top>0)
{p=s[--top];
p=p->rchild;
}
}
}
void main ()
{printf("请输入字符串");
bitree T=null;
T=creat();
getchar();
printf("先序遍历:");
Porderf(T);
getchar();
}
[解决办法]
把原始题目贴出来!