这个程序有问题啊
#include "stdio.h"#include "stdlib.h"
struct node
{
struct node *lchild;
char x;
struct node * rchild;
};
void creattree(struct node *p)
{
char ch;
scanf("%c",&ch);
if(ch=='#')
return ;
p=(struct node*)malloc(sizeof(struct node));
p->x=ch;
creattree(p->lchild);
creattree(p->rchild);
return p;
}
void f1(struct node *p)
{
if(p!=NULL)
printf("%3d",p->x);
f1(p->lchild);
f1(p->rchild);
}
main()
{
struct node *p;
creattree(p);
f1(p);
return;
}