二叉树的递归递归遍历有错误?
#include<stdio.h>#include<stdlib.h>
typedef struct BiTnode
{
char data;
struct bitnode *lchild,*rchild;
}BiTnode,*BiTree;
BiTree createtree()
{
char a;BiTree root;
scanf("%c",&a);
fflush(stdin);
if(a=='#')return NULL;
else
{
root=(BiTnode *)malloc(sizeof(BiTnode));
root->data=a;
root->lchild=createtree();
root->rchild=createtree();
}
return root;
}
void inorder(BiTree root)
{
BiTree s[100];
int top=0;
while(root||top)
{
while(root)
{
s[++top]=root;root=root->lchild;
}
if(top)
{
putchar(s[top]->data);
root=s[top--]->rchild;
}
}
}
void main()
{
BiTree root=NULL;
root=createtree();
inorder(root);
printf("\n");
}