求解答,解答就采纳,感谢
#include<stdio.h>
#include<stdlib.h>
typedef struct BiTNode
{
char data;
struct BiTNode *lchild, *rchild;
}BiTreeNode, *BiTree;
BiTree CreateBiTree(char str[100]);
void show(BiTree bt);
int main()
{
BiTree bt;
char str[100];
gets(str);
CreateBiTree(str);
show(bt);
return 0;
}
BiTree CreateBiTree(char str[])
{
BiTree bt;
static int i=0;
char c=str[i++];
if(c=='#') bt=NULL;
else
{
bt=(BiTree)malloc(sizeof(BiTreeNode));
bt->data=c;
bt->lchild=CreateBiTree(str);
bt->rchild=CreateBiTree(str);
}
return bt;
}
void show(BiTree bt)
{
if(bt)
{
show(bt->lchild);
printf("%c",bt->data);
show(bt->rchild);
}
}