#include<stdio.h>
#include<malloc.h>
typedef struct ThrTreeNode * PThrTreeNode;
struct ThrTreeNode{ char data;
PThrTreeNode lchild,rchild;
};
//建立二叉树
void CreateBinTree(PThrTreeNode T)
{ char ch;
scanf("%c",&ch);
if(ch=='.') T=NULL;
else
{ PThrTreeNode T=(PThrTreeNode)malloc(sizeof(struct ThrTreeNode));
if(T==NULL) {printf("分配空间失败");
return;
} //生成一个新节点
T->data=ch;
CreateBinTree(T->lchild);
CreateBinTree(T->rchild);
}
}
void Inorder(PThrTreeNode T)
{ if(T) { Inorder(T->lchild);
printf("%c",T->data);
Inorder(T->rchild);}
}
void main()
{struct ThrTreeNode * T;
CreateBinTree(T);
Inorder(T);
}
不能输出遍历的序列???