主题:[讨论][求助]请帮我看一下我的程序哪里错拉
[em18] 自己做的 有二叉树的创建 和先序遍历 但是输出结果有问题 请大家帮我指点一下 谢谢你们哦
#include<stdio.h>
#include<stdlib.h>
#define maxsize 50
typedef struct tnode
{ char data;
struct tnode *lchild,*rchild; }
bitree;
bitree *t,v;
Creatbitree(t)
bitree *t;
{ char ch;
scanf("%c",&ch);
if(ch=='')
t=NULL;
else
{ t=malloc(sizeof(bitree));
t->data=ch;
Creatbitree(t->lchild);
Creatbitree(t->rchild); } }
PREORDER(t)
bitree *t;
{ if(t)
{ printf("%c",t->data);
PREORDER(t->lchild);
PREORDER(t->rchild); } }
main()
{ t=&v;
Creatbitree(t);
PREORDER(t); }
#include<stdio.h>
#include<stdlib.h>
#define maxsize 50
typedef struct tnode
{ char data;
struct tnode *lchild,*rchild; }
bitree;
bitree *t,v;
Creatbitree(t)
bitree *t;
{ char ch;
scanf("%c",&ch);
if(ch=='')
t=NULL;
else
{ t=malloc(sizeof(bitree));
t->data=ch;
Creatbitree(t->lchild);
Creatbitree(t->rchild); } }
PREORDER(t)
bitree *t;
{ if(t)
{ printf("%c",t->data);
PREORDER(t->lchild);
PREORDER(t->rchild); } }
main()
{ t=&v;
Creatbitree(t);
PREORDER(t); }