Binary Tree: A Problem Concerning the Function of Generating Binary Tree

  c++, question

Code 1:

typedef struct Node{
 char data;
 struct Node * LChild;
 struct Node * RChild;
 }BiTNode,*BiTree;
 //
 void CreateBiTree(BiTree * bt){
 char ch;
 ch=getchar();
 if(ch=='.'){
 *bt=NULL;
 }
 else{
 *bt=(BiTree)malloc(sizeof(BiTNode));
 (*bt)->data=ch;
 CreateBiTree(&(*bt)->LChild);
 CreateBiTree(&(*bt)->RChild);
 }
 }
 
 void main(){
 BiTree b;
 CreateBiTree(BiTree &b)
 }

Code 2:

typedef struct Node{
 char data;
 struct Node * LChild;
 struct Node * RChild;
 }BiTNode,*BiTree;
 //
 void CreateBiTree(BiTree  bt){
 char ch;
 ch=getchar();
 if(ch=='.'){
 bt=NULL;
 }
 else{
 bt=(BiTree)malloc(sizeof(BiTNode));
 bt->data=ch;
 CreateBiTree(bt->LChild);
 CreateBiTree(bt->RChild);
 }
 }
 
 void main(){
 BiTree b;
 CreateBiTree(BiTree b)
 }

Question: 1. Code 1 is the correct operation. May I know what is wrong with Code 2? (If the binary tree created by code 2 calls traversal function, there will be a direct error. During debugging, it is found that the data, LCHILD and RCHILD memory of the tree created by code 2 are unknown data)

2.&(*bt) is equivalent to bt? Why? According to my understanding, meeting with * should offset it ..

Note that functions are always copied when parameters are passed in. When pointers are passed in, pointer variables are copied. Pointer variables of formal parameters and real parameters are two different variables, only pointing to the same area.CreateBiTreeObviously, if you apply for memory in a function and assign a value to a parameter, then the parameter pointer mustStep up one levelOtherwise, the memory requested in the function is pointed to by the formal parameters of the function, the actual parameters have not changed, and the memory leaks.