求大神解答 为什么运行一半就不运行了??
程序代码:
#include<stdio.h>
#include<stdlib.h>
typedef struct bitree
{
char data;
struct bitree *lchild,*rchild;
}*Bitree,Binode;
void Create(Bitree T)
{
char ch;
ch=getchar();
if(ch=='#')
{
T=NULL;
}
else
{
T=(Bitree)malloc(sizeof (Binode));
T->data=ch;
Create(T->lchild);
Create(T->rchild);
}
}
void Before(Bitree T)//先序遍历
{
if(T)
{
printf("%c",T->data);
Before(T->lchild);
Before(T->rchild);
}
}
int main()
{
Binode T;
Create(&T);
printf("pre:");
Before(&T);
printf("\n");
return 0;
}我输入的是
ABC#E##DG###F##
运行结果是
pre:B
二叉树长这样
A
B F
C D
E G
[此贴子已经被作者于2019-5-19 18:25编辑过]








