Language: C

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeSearch(Node u, int k){
  while(u != NIL && u->key != k){
  if( u->key > k)u = u->left;
  else u = u->right;
  }
  return u;
}

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

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

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

  z->parent = y;
  if(y == NIL) {
    root = z;  
  }
  else if(z->key < y->key){
    y->left = z;
  }
  else y->right = z;
}


void inorder(Node u){
  if(u->left != NIL){
    inorder(u->left);
  }
  printf(" %d",u->key);
  if(u->right != NIL){
    inorder(u->right);
  }

}
void preorder(Node u){
  printf(" %d",u->key);
  if(u->left!= NIL){
    preorder(u->left);
  }
  if(u->right!= NIL){
    preorder(u->right);
  }
}

int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

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

Compiler output:
main.c: In function 'treeSearch':
main.c:8:13: error: 'NULL' undeclared (first use in this function)
    8 | #define NIL NULL
      |             ^~~~
main.c:13:14: note: in expansion of macro 'NIL'
   13 |   while(u != NIL && u->key != k){
      |              ^~~
main.c:1:1: note: 'NULL' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
  +++ |+#include <stddef.h>
    1 | struct node{
main.c:8:13: note: each undeclared identifier is reported only once for each function it appears in
    8 | #define NIL NULL
      |             ^~~~
main.c:13:14: note: in expansion of macro 'NIL'
   13 |   while(u != NIL && u->key != k){
      |              ^~~
main.c: In function 'insert':
main.c:8:13: error: 'NULL' undeclared (first use in this function)
    8 | #define NIL NULL
      |             ^~~~
main.c:21:12: note: in expansion of macro 'NIL'
   21 |   Node y = NIL;
      |            ^~~
main.c:8:13: note: 'NULL' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
    8 | #define NIL NULL
      |             ^~~~
main.c:21:12: note: in expansion of macro 'NIL'
   21 |   Node y = NIL;
      |            ^~~
main.c:25:7: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
   25 |   z = malloc(sizeof(struct node));
      |       ^~~~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
  +++ |+#include <stdlib.h>
    1 | struct node{
main.c:25:7: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
   25 |   z = malloc(sizeof(struct node));
      |       ^~~~~~
main.c:25:7: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c: In function 'inorder':
main.c:8:13: error: 'NULL' undeclared (first use in this function)
    8 | #define NIL NULL
      |             ^~~~
main.c:50:17: note: in expansion of macro 'NIL'
   50 |   if(u->left != NIL){
      |                 ^~~
main.c:8:13: note: 'NULL' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
    8 | #define NIL NULL
      |             ^~~~
main.c:50:17: note: in expansion of macro 'NIL'
   50 |   if(u->left != NIL){
      |                 ^~~
main.c:53:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   53 |   printf(" %d",u->key);
      |   ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | struct node{
main.c:53:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   53 |   printf(" %d",u->key);
      |   ^~~~~~
main.c:53:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: In function 'preorder':
main.c:60:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   60 |   printf(" %d",u->key);
      |   ^~~~~~
main.c:60:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:8:13: error: 'NULL' undeclared (first use in this function)
    8 | #define NIL NULL
      |             ^~~~
main.c:61:16: note: in expansion of macro 'NIL'
   61 |   if(u->left!= NIL){
      |                ^~~
main.c:8:13: note: 'NULL' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
    8 | #define NIL NULL
      |             ^~~~
main.c:61:16: note: in expansion of macro 'NIL'
   61 |   if(u->left!= NIL){
      |                ^~~
main.c: In function 'main':
main.c:72:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   72 |   scanf("%d", &n);
      |   ^~~~~
main.c:72:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:72:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
main.c:72:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:8:13: error: 'NULL' undeclared (first use in this function)
    8 | #define NIL NULL
      |             ^~~~
main.c:79:17: note: in expansion of macro 'NIL'
   79 |       if ( t != NIL ) printf("yes\n");
      |                 ^~~
main.c:8:13: note: 'NULL' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
    8 | #define NIL NULL
      |             ^~~~
main.c:79:17: note: in expansion of macro 'NIL'
   79 |       if ( t != NIL ) printf("yes\n");
      |                 ^~~
main.c:79:23: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   79 |       if ( t != NIL ) printf("yes\n");
      |                       ^~~~~~
main.c:79:23: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:80:12: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   80 |       else printf("no\n");
      |            ^~~~~~
main.c:80:12: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:86:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   86 |       printf("\n");
      |       ^~~~~~
main.c:86:7: note: include '<stdio.h>' or provide a declaration of 'printf'