Language: C

#include <stdio.h>
#include <stdlib.h>
 
typedef struct node{
  int key;
  struct node *p;
  struct node *l;
  struct node *r;
};
typedef struct node  *Node;
Node root = NULL;
 
Node createNode(){
  Node z = malloc(sizeof(struct node));
  z->l = NULL;
  z->r = NULL;
  z->p = NULL;
  z->key = 0;
  return z;
}
 
int insert(int key){
   
  NodePointer z = createNode();
  NodePointer y = NULL;
  NodePointer x = root;
  z->key = key;
   
  while(x != NULL){
    y = x;
    if(z->key < x->key) x = x->l;
    else x = x->r;
  }
  z->p = y;
  if(y == NULL) root = z;
  else if(z->key < y->key) y->l = z;
  else y->r = z;
}
   
void inorder(NodePointer p){
     
  if(p != NULL){
    inorder(p->l);
    printf(" %d",p->key);
    inorder(p->r);
  }
}
 
void preorder(NodePointer p){
  if(p != NULL){
    printf(" %d",p->key);
    preorder(p->l);
    preorder(p->r);
  }
}
 
int main(void){
 
  int i,key,n;
  char str[20];
 
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    scanf("%s",str);
 
    if(str[0] == 'i'){
      scanf("%d",&key);
      insert(key);
    }
    else if(str[0] == 'p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}

Compiler output:
main.c:9:1: warning: useless storage class specifier in empty declaration
    9 | };
      | ^
main.c: In function 'insert':
main.c:24:3: error: unknown type name 'NodePointer'
   24 |   NodePointer z = createNode();
      |   ^~~~~~~~~~~
main.c:24:19: error: initialization of 'int' from 'Node' {aka 'struct node *'} makes integer from pointer without a cast [-Wint-conversion]
   24 |   NodePointer z = createNode();
      |                   ^~~~~~~~~~
main.c:25:3: error: unknown type name 'NodePointer'
   25 |   NodePointer y = NULL;
      |   ^~~~~~~~~~~
main.c:25:19: error: initialization of 'int' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
   25 |   NodePointer y = NULL;
      |                   ^~~~
main.c:26:3: error: unknown type name 'NodePointer'
   26 |   NodePointer x = root;
      |   ^~~~~~~~~~~
main.c:26:19: error: initialization of 'int' from 'Node' {aka 'struct node *'} makes integer from pointer without a cast [-Wint-conversion]
   26 |   NodePointer x = root;
      |                   ^~~~
main.c:27:4: error: invalid type argument of '->' (have 'int')
   27 |   z->key = key;
      |    ^~
main.c:29:11: warning: comparison between pointer and integer
   29 |   while(x != NULL){
      |           ^~
main.c:31:9: error: invalid type argument of '->' (have 'int')
   31 |     if(z->key < x->key) x = x->l;
      |         ^~
main.c:31:18: error: invalid type argument of '->' (have 'int')
   31 |     if(z->key < x->key) x = x->l;
      |                  ^~
main.c:31:30: error: invalid type argument of '->' (have 'int')
   31 |     if(z->key < x->key) x = x->l;
      |                              ^~
main.c:32:15: error: invalid type argument of '->' (have 'int')
   32 |     else x = x->r;
      |               ^~
main.c:34:4: error: invalid type argument of '->' (have 'int')
   34 |   z->p = y;
      |    ^~
main.c:35:8: warning: comparison between pointer and integer
   35 |   if(y == NULL) root = z;
      |        ^~
main.c:35:22: error: assignment to 'Node' {aka 'struct node *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
   35 |   if(y == NULL) root = z;
      |                      ^
main.c:36:12: error: invalid type argument of '->' (have 'int')
   36 |   else if(z->key < y->key) y->l = z;
      |            ^~
main.c:36:21: error: invalid type argument of '->' (have 'int')
   36 |   else if(z->key < y->key) y->l = z;
      |                     ^~
main.c:36:29: error: invalid type argument of '->' (have 'int')
   36 |   else if(z->key < y->key) y->l = z;
      |                             ^~
main.c:37:9: error: invalid type argument of '->' (have 'int')
   37 |   else y->r = z;
      |         ^~
main.c: At top level:
main.c:40:14: error: unknown type name 'NodePointer'
   40 | void inorder(NodePointer p){
      |              ^~~~~~~~~~~
main.c:49:15: error: unknown type name 'NodePointer'
   49 | void preorder(NodePointer p){
      |               ^~~~~~~~~~~
main.c: In function 'main':
main.c:72:7: error: implicit declaration of function 'inorder' [-Wimplicit-function-declaration]
   72 |       inorder(root);
      |       ^~~~~~~
main.c:74:7: error: implicit declaration of function 'preorder' [-Wimplicit-function-declaration]
   74 |       preorder(root);
      |       ^~~~~~~~