#include<stdio.h>
#include<malloc.h>
typedef struct BTNode{
int data;
struct BTNode *Lchild,*Rchild;
}BiTnode,*Btree;
//递归算法创建二叉树
void CreatBTree(Btree tr){
int ch;
scanf("%d",&ch);
if(ch==0)
tr=NULL;
else{
tr=(Btree)malloc(sizeof(BiTnode));
tr->data=ch;
CreatBTree(tr->Lchild);
CreatBtree(tr->Rchild);
}
}
int main(){
Btree bt=NULL;
CreatBtree(bt);
return 0;
}
void CreatBtree(Btree tr)这句话怎么修改能使传过去的bt 再返回来创建好的树?
慕码人1088981
Yexiaomo
随时随地看视频慕课网APP
相关分类