二叉树创建函数
#include<stdio.h>
#include<stdlib.h>
struct node
{
int data;
struct node *lchild;
struct node *rchild;
};
typedef struct node BT;
BT * Create(BT * root);
int main()
{
BT *root;
root = (BT*)malloc(sizeof(BT));
Create(root);
return 0;
}
BT * Create(BT * root)//
{
BT *lchild, *rchild;
if(!root)
return NULL;
scanf("%d", root->data);
if (!root->data)
return NULL;
lchild = (BT*)malloc(sizeof(BT));
root->lchild = Create(lchild);
rchild = (BT *)malloc(sizeof(BT));
root->rchild = Create(rchild);
return root;
}
这个树创建函数哪里有问题