|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include<stdio.h>
#include<malloc.h>
typedef struct Node
{
char ch;
struct Node *Lchild;
struct Node *Rchild;
}BiNode,*BiTree;
BiTree create(BiNode *bt)
{
char ch;
int flag1=1;
BiNode *bt1;
printf("please input a char:");
flushall();
ch=getchar();
if(ch=='#')
{
return NULL;
}
bt=(BiNode *)malloc(sizeof(BiNode));
bt->ch=ch;
if(flag1==1)
{
bt1=bt;
flag1=0;
}
create(bt->Lchild);
create(bt->Rchild);
return bt1;
}
void print(BiTree bt)
{
if(bt==NULL)
{
printf("Is empty!\n");
return;
}
else
{
printf("%c ",bt->ch);
print(bt->Lchild);
print(bt->Rchild);
}
}
main()
{
BiTree s;
s=create(s);
print(s);
printf("\n");
}
这个程序哪里有问题,大侠帮帮忙!
|
|