[求助]一个C语言创建二叉树的程序
根据课本上的伪码改的,可是运行后总是不对,请大家帮忙指出问题:程序:
#include<stdio.h>
struct tree
{char data;
struct tree *lc;
struct tree *rc;};
struct tree *create(struct tree *T)
{char ch;
ch=getchar();
if(ch==' '){printf("*");T=NULL;}
else{
T=(struct tree *)malloc(sizeof(struct tree));
T->data=ch;
create(T->lc);
create(T->rc);};
return T;
}