Language: C

void insert(int);
void inorder(Node*);
void preorder(Node*);

int main(){
  int n,i,x;
  char com[20];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",com);
    if(com[0]=='i'){
      scanf("%d",&x);
      insert(x);
    } else if(com[0]=='p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}


void insert(int k){
 Node *y=NIL;
 Node *x=root;
 Node *z;

z=malloc(sizeof(Node));
  z->key=k;
  z->l=NIL;
  z->r=NIL;

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

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


void inorder(Node *u){
  if(u==NIL)return;
  inorder(u->l);
  printf(" %d",u->key);
  inorder(u->r);
}

void preorder(Node *u){
  if(u==NIL)return;
  printf(" %d",u->key);
  preorder(u->l);
  preorder(u->r);
}

Compiler output:
main.c:2:14: error: unknown type name 'Node'
    2 | void inorder(Node*);
      |              ^~~~
main.c:3:15: error: unknown type name 'Node'
    3 | void preorder(Node*);
      |               ^~~~
main.c: In function 'main':
main.c:9:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    9 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | void insert(int);
main.c:9:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    9 |   scanf("%d",&n);
      |   ^~~~~
main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:16:7: error: implicit declaration of function 'inorder' [-Wimplicit-function-declaration]
   16 |       inorder(root);
      |       ^~~~~~~
main.c:16:15: error: 'root' undeclared (first use in this function)
   16 |       inorder(root);
      |               ^~~~
main.c:16:15: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:7: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   17 |       printf("\n");
      |       ^~~~~~
main.c:17:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:17:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:17:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:18:7: error: implicit declaration of function 'preorder' [-Wimplicit-function-declaration]
   18 |       preorder(root);
      |       ^~~~~~~~
main.c: In function 'insert':
main.c:27:2: error: unknown type name 'Node'
   27 |  Node *y=NIL;
      |  ^~~~
main.c:27:10: error: 'NIL' undeclared (first use in this function)
   27 |  Node *y=NIL;
      |          ^~~
main.c:28:2: error: unknown type name 'Node'
   28 |  Node *x=root;
      |  ^~~~
main.c:28:10: error: 'root' undeclared (first use in this function)
   28 |  Node *x=root;
      |          ^~~~
main.c:29:2: error: unknown type name 'Node'
   29 |  Node *z;
      |  ^~~~
main.c:31:3: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
   31 | z=malloc(sizeof(Node));
      |   ^~~~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
  +++ |+#include <stdlib.h>
    1 | void insert(int);
main.c:31:3: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
   31 | z=malloc(sizeof(Node));
      |   ^~~~~~
main.c:31:3: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c:31:17: error: 'Node' undeclared (first use in this function)
   31 | z=malloc(sizeof(Node));
      |                 ^~~~
main.c:32:4: error: request for member 'key' in something not a structure or union
   32 |   z->key=k;
      |    ^~
main.c:33:4: error: request for member 'l' in something not a structure or union
   33 |   z->l=NIL;
      |    ^~
main.c:34:4: error: request for member 'r' in something not a structure or union
   34 |   z->r=NIL;
      |    ^~
main.c:38:9: error: request for member 'key' in something not a structure or union
   38 |     if(z->key < x->key){
      |         ^~
main.c:38:18: error: request for member 'key' in something not a structure or union
   38 |     if(z->key < x->key){
      |                  ^~
main.c:39:10: error: request for member 'l' in something not a structure or union
   39 |       x=x->l;
      |          ^~
main.c:41:10: error: request for member 'r' in something not a structure or union
   41 |       x=x->r;
      |          ^~
main.c:45:4: error: request for member 'p' in something not a structure or union
   45 |   z->p=y;
      |    ^~
main.c:49:9: error: request for member 'key' in something not a structure or union
   49 |     if(z->key < y->key){
      |         ^~
main.c:49:18: error: request for member 'key' in something not a structure or union
   49 |     if(z->key < y->key){
      |                  ^~
main.c:50:8: error: request for member 'l' in something not a structure or union
   50 |       y->l=z;
      |        ^~
main.c:52:8: error: request for member 'r' in something not a structure or union
   52 |       y->r=z;
      |        ^~
main.c: At top level:
main.c:58:14: error: unknown type name 'Node'
   58 | void inorder(Node *u){
      |              ^~~~
main.c:65:15: error: unknown type name 'Node'
   65 | void preorder(Node *u){
      |               ^~~~