Language: C

#include<stdio.h>
#include<stdlib.h>
#define NIL NULL

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");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}


struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;


Node root;

Node treeMinimum(Node x){


}

Node treeMaximum(Node x){


}

Node treeSearch(Node u, int k){


}

Node treeSuccessor(Node x){


}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}

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)
{
if(z->key<x->key)
{
x=x->left;
}
else if(x->key<=y->key)
{
x=x->right;
}
}

z->parent = y;
if(y!=NIL)
{
root=z;
}

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





void inorder(Node u){

}
void preorder(Node u){

}

Compiler output:
main.c: In function 'main':
main.c:14:7: error: unknown type name 'Node'
   14 |       Node t = treeSearch(root, x);
      |       ^~~~
main.c:14:16: error: implicit declaration of function 'treeSearch' [-Wimplicit-function-declaration]
   14 |       Node t = treeSearch(root, x);
      |                ^~~~~~~~~~
main.c:14:27: error: 'root' undeclared (first use in this function)
   14 |       Node t = treeSearch(root, x);
      |                           ^~~~
main.c:14:27: note: each undeclared identifier is reported only once for each function it appears in
main.c:15:14: warning: comparison between pointer and integer
   15 |       if ( t != NIL ) printf("yes\n");
      |              ^~
main.c:19:7: error: implicit declaration of function 'insert' [-Wimplicit-function-declaration]
   19 |       insert(x);
      |       ^~~~~~
main.c:21:7: error: implicit declaration of function 'inorder' [-Wimplicit-function-declaration]
   21 |       inorder(root);
      |       ^~~~~~~
main.c:23:7: error: implicit declaration of function 'preorder' [-Wimplicit-function-declaration]
   23 |       preorder(root);
      |       ^~~~~~~~
main.c:27:7: error: implicit declaration of function 'treeDelete' [-Wimplicit-function-declaration]
   27 |       treeDelete(treeSearch(root, x));
      |       ^~~~~~~~~~
main.c: At top level:
main.c:56:6: error: conflicting types for 'treeSearch'; have 'struct node *(struct node *, int)'
   56 | Node treeSearch(Node u, int k){
      |      ^~~~~~~~~~
main.c:14:16: note: previous implicit declaration of 'treeSearch' with type 'int()'
   14 |       Node t = treeSearch(root, x);
      |                ^~~~~~~~~~
main.c:66:6: warning: conflicting types for 'treeDelete'; have 'void(struct node *)'
   66 | void treeDelete(Node z){
      |      ^~~~~~~~~~
main.c:27:7: note: previous implicit declaration of 'treeDelete' with type 'void(struct node *)'
   27 |       treeDelete(treeSearch(root, x));
      |       ^~~~~~~~~~
main.c:74:6: warning: conflicting types for 'insert'; have 'void(int)'
   74 | void insert(int k){
      |      ^~~~~~
main.c:19:7: note: previous implicit declaration of 'insert' with type 'void(int)'
   19 |       insert(x);
      |       ^~~~~~
main.c:116:6: warning: conflicting types for 'inorder'; have 'void(struct node *)'
  116 | void inorder(Node u){
      |      ^~~~~~~
main.c:21:7: note: previous implicit declaration of 'inorder' with type 'void(struct node *)'
   21 |       inorder(root);
      |       ^~~~~~~
main.c:119:6: warning: conflicting types for 'preorder'; have 'void(struct node *)'
  119 | void preorder(Node u){
      |      ^~~~~~~~
main.c:23:7: note: previous implicit declaration of 'preorder' with type 'void(struct node *)'
   23 |       preorder(root);
      |       ^~~~~~~~