Language: C++

#include <bits/stdc++.h>
using namespace std;

struct Node{
Node *r, *l, *p;
int key;
};

Node *T;

void insert(int x){

Node *z;
z.p = z.r = z.l = NIL;
z.p = k;
Node *y = NIL;
Node *x = T;

while(x != NIL){
y = x;
if(z->key < x->key){
x = x.l;
}else if(z -> key > x -> key){
x = x.r;
}

z.p = y;
if(y == NIL){
z = T;
}else if(y -> key < z -> key){
y.r = z;
}else if(y -> key < z -> key){
y.r = z;
}


}

}

void pre_print(int x){
  if(x == -1) return;
  cout << " " << x;
  pre_print(T.l);
  pre_print(T.r);
}
 
void in_print(int x){
  if(x == -1) return;
  in_print(T.l);
  cout << " " << x;
  in_print(T.r);
}



int main(){

int n;
string str;

cin >> n;

for(int i = 0; i < n; i++){
int k;
cin >> str >> k;
if(str == "insert"){
insert(k);
}else if(str == "print"){
in_print();
cout << endl;
pre_print();
cout << endl;
}
}



}

Compiler output:
a.cc: In function 'void insert(int)':
a.cc:14:3: error: request for member 'p' in 'z', which is of pointer type 'Node*' (maybe you meant to use '->' ?)
   14 | z.p = z.r = z.l = NIL;
      |   ^
a.cc:14:9: error: request for member 'r' in 'z', which is of pointer type 'Node*' (maybe you meant to use '->' ?)
   14 | z.p = z.r = z.l = NIL;
      |         ^
a.cc:14:15: error: request for member 'l' in 'z', which is of pointer type 'Node*' (maybe you meant to use '->' ?)
   14 | z.p = z.r = z.l = NIL;
      |               ^
a.cc:14:19: error: 'NIL' was not declared in this scope
   14 | z.p = z.r = z.l = NIL;
      |                   ^~~
a.cc:15:3: error: request for member 'p' in 'z', which is of pointer type 'Node*' (maybe you meant to use '->' ?)
   15 | z.p = k;
      |   ^
a.cc:15:7: error: 'k' was not declared in this scope
   15 | z.p = k;
      |       ^
a.cc:17:7: error: declaration of 'Node* x' shadows a parameter
   17 | Node *x = T;
      |       ^
a.cc:11:17: note: 'int x' previously declared here
   11 | void insert(int x){
      |             ~~~~^
a.cc:22:7: error: request for member 'l' in 'x', which is of pointer type 'Node*' (maybe you meant to use '->' ?)
   22 | x = x.l;
      |       ^
a.cc:24:7: error: request for member 'r' in 'x', which is of pointer type 'Node*' (maybe you meant to use '->' ?)
   24 | x = x.r;
      |       ^
a.cc:27:3: error: request for member 'p' in 'z', which is of pointer type 'Node*' (maybe you meant to use '->' ?)
   27 | z.p = y;
      |   ^
a.cc:31:3: error: request for member 'r' in 'y', which is of pointer type 'Node*' (maybe you meant to use '->' ?)
   31 | y.r = z;
      |   ^
a.cc:33:3: error: request for member 'r' in 'y', which is of pointer type 'Node*' (maybe you meant to use '->' ?)
   33 | y.r = z;
      |   ^
a.cc: In function 'void pre_print(int)':
a.cc:44:15: error: request for member 'l' in 'T', which is of pointer type 'Node*' (maybe you meant to use '->' ?)
   44 |   pre_print(T.l);
      |               ^
a.cc:45:15: error: request for member 'r' in 'T', which is of pointer type 'Node*' (maybe you meant to use '->' ?)
   45 |   pre_print(T.r);
      |               ^
a.cc: In function 'void in_print(int)':
a.cc:50:14: error: request for member 'l' in 'T', which is of pointer type 'Node*' (maybe you meant to use '->' ?)
   50 |   in_print(T.l);
      |              ^
a.cc:52:14: error: request for member 'r' in 'T', which is of pointer type 'Node*' (maybe you meant to use '->' ?)
   52 |   in_print(T.r);
      |              ^
a.cc: In function 'int main()':
a.cc:70:9: error: too few arguments to function 'void in_print(int)'
   70 | in_print();
      | ~~~~~~~~^~
a.cc:48:6: note: declared here
   48 | void in_print(int x){
      |      ^~~~~~~~
a.cc:72:10: error: too few arguments to function 'void pre_print(int)'
   72 | pre_print();
      | ~~~~~~~~~^~
a.cc:41:6: note: declared here
   41 | void pre_print(int x){
      |      ^~~~~~~~~