criyle/codenet-compile-errors huggingface dataset:
Language: C


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


struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
Node root;
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){
if(u!=NIL)
{
inorder(u->left);
printf(" %d",u->key);
inorder(u->right);
}
}
void preorder(Node u){
if(u!=NIL)
{
printf(" %d",u->key);
preorder(u->left);
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] == '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:85:3: error: expected identifier or '(' before '}' token
   85 |   }
      |   ^
main.c:87:3: error: expected identifier or '(' before 'return'
   87 |   return 0;
      |   ^~~~~~
main.c:88:1: error: expected identifier or '(' before '}' token
   88 | }
      | ^
Language: C

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

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

typedef struct node * Node;
struct Node root;

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

void insert(int k){
  Node y = NIL;  //xの親
  Node x = root; //Tの根
  Node z;
 
  z = (Node)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 z){ // 中間順巡回の出力
  if( z->left != NIL ) inorder( z->left );
  printf(" %d",z->key);
  if( z->right != NIL ) inorder( z->right );
}

void preorder(Node z){ // 先行順巡回の出力
  printf(" %d",z->key);
  if( z->left != NIL ) preorder(z->left);
  if( z->right != NIL ) preorder(z->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] == '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 'insert':
main.c:21:12: error: 'root' has an incomplete type 'struct Node'
   21 |   Node x = root; //Tの根
      |            ^~~~
main.c:35:21: error: 'root' has an incomplete type 'struct Node'
   35 |   if(y == NIL) root = z;
      |                     ^
main.c: In function 'main':
main.c:65:15: error: 'root' has an incomplete type 'struct Node'
   65 |       inorder(root);
      |               ^~~~
main.c:67:16: error: 'root' has an incomplete type 'struct Node'
   67 |       preorder(root);
      |                ^~~~
main.c: At top level:
main.c:13:13: error: storage size of 'root' isn't known
   13 | struct Node root;
      |             ^~~~
Language: C

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


struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
Node root;
  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(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){
if(u!=NIL)
{
inorder(u->left);
printf(" %d",u->key);
inorder(u->right);
}
}
void preorder(Node u){
if(u!=NIL)
{
printf(" %d",u->key);
preorder(u->left);
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] == '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:14:3: error: expected identifier or '(' before 'if'
   14 |   if ( com[0] == 'i' ){
      |   ^~
main.c:17:7: error: expected identifier or '(' before 'else'
   17 |     } else if ( com[0] == 'p' ){
      |       ^~~~
main.c:24:3: error: expected identifier or '(' before 'return'
   24 |   return 0;
      |   ^~~~~~
main.c:25:1: error: expected identifier or '(' before '}' token
   25 | }
      | ^
Language: C

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


struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
Node root;
  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(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){
if(u!=NIL)
{
inorder(u->left);
printf(" %d",u->key);
inorder(u->right);
}
}
void preorder(Node u){
if(u!=NIL)
{
printf(" %d",u->key);
preorder(u->left);
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] == 'i' ){
      scanf("%d", &n);
      insert(n);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
  }

  return 0;
}

Compiler output:
main.c:14:3: error: expected identifier or '(' before 'if'
   14 |   if ( com[0] == 'i' ){
      |   ^~
main.c:17:7: error: expected identifier or '(' before 'else'
   17 |     } else if ( com[0] == 'p' ){
      |       ^~~~
main.c:24:3: error: expected identifier or '(' before 'return'
   24 |   return 0;
      |   ^~~~~~
main.c:25:1: error: expected identifier or '(' before '}' token
   25 | }
      | ^
Language: C

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


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

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){
if(u!=NIL)
{
inorder(u->left);
printf(" %d",u->key);
inorder(u->right);
}
}
void preorder(Node u){
if(u!=NIL)
{
printf(" %d",u->key);
preorder(u->left);
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] == 'i' ){
      scanf("%d", &n);
      insert(n);
  }
  }
    else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
  }

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:80:5: error: 'else' without a previous 'if'
   80 |     else if ( com[0] == 'p' ){
      |     ^~~~
Language: C

#include<stdio.h>
#include<stdlib.h>

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

#define NIL NULL

Node root;

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

/*Node treeMinimum(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 ) {
    y = x;

    if( x->key > z->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 == NIL ) return ;
  inorder( u->left );
  printf("%d",u->key);
  printf(" ");
  inorder( u->right );

}

void preorder(Node u){

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

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:111:16: error: implicit declaration of function 'treeSearch' [-Wimplicit-function-declaration]
  111 |       Node t = treeSearch(root, x);
      |                ^~~~~~~~~~
main.c:111:16: error: initialization of 'Node' {aka 'struct node *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
main.c:132:7: error: implicit declaration of function 'treeDelete' [-Wimplicit-function-declaration]
  132 |       treeDelete(treeSearch(root, x));
      |       ^~~~~~~~~~
Language: C

#include<stdio.h>
#include<stdlib.h>

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

#define NIL NULL

Node root;
Node treeMinimum(Node);
Node treeSearch(Node,int);
void treeSuccessor(Node);
void treeDelete(Node);
void insert(int);
void inorder(Node);
void preorder(Node);

Node treeMinimum(Node x){
  while( x->left > NIL ) x = x->left;
  return x;
}

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

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 ) {
    y = x;

    if( x->key > z->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 == NIL ) return ;
  inorder( u->left );
  printf("%d",u->key);
  printf(" ");
  inorder( u->right );

}

void preorder(Node u){

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

  return 0;
}

Compiler output:
main.c: In function 'treeMinimum':
main.c:24:18: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
   24 |   while( x->left > NIL ) x = x->left;
      |                  ^
main.c: At top level:
main.c:36:6: error: conflicting types for 'treeSuccessor'; have 'struct node *(struct node *)'
   36 | Node treeSuccessor(Node x){
      |      ^~~~~~~~~~~~~
main.c:17:6: note: previous declaration of 'treeSuccessor' with type 'void(struct node *)'
   17 | void treeSuccessor(Node);
      |      ^~~~~~~~~~~~~
Language: C

#include <stdio.h>

#define MAX 100000


int insert(int*, int );
struct search{
  int right;
  int left;
  int p;
  int key;
}

  search x,y;

int main(){
  int i,x,y,v,T[MAX];

  scanf("%d",&v);
  for ( i = 0;i < v;i++){
    printf("insert");
    scanf("%d",&T[i]);

    insert(T[i],T[i-1]);
  }
  printf("print\n");



}
int insert(int *T, search z){
    y = NULL; // x の親
  x = T[0];
  while (x ≠ NULL){
    y = x; // 親を設定
    if (z.key < x.key)
      x = x.left; // 左の子へ移動
    else 
      x = x.right; // 右の子へ移動
  }
  z.p = y;

  if( y == NULL) // T が空の場合
    T[0] = z;
  else if (z.key < y.key)
    y.left = z; // z を y の左の子にする
  else 
    y.right = z; // z を y の右の子にする
}

Compiler output:
main.c:14:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'x'
   14 |   search x,y;
      |          ^
main.c: In function 'main':
main.c:24:13: error: passing argument 1 of 'insert' makes pointer from integer without a cast [-Wint-conversion]
   24 |     insert(T[i],T[i-1]);
      |            ~^~~
      |             |
      |             int
main.c:6:12: note: expected 'int *' but argument is of type 'int'
    6 | int insert(int*, int );
      |            ^~~~
main.c: At top level:
main.c:31:20: error: unknown type name 'search'
   31 | int insert(int *T, search z){
      |                    ^~~~~~
main.c:34:12: error: stray '\342' in program
   34 |   while (x <U+2260> NULL){
      |            ^~~~~~~~
Language: C

#include <stdio.h>

#define MAX 100000


int insert(int*, int );
struct search{
  int right;
  int left;
  int p;
  int key;
}

  search x,y,*T;

int main(){
  int i,v;

  scanf("%d",&v);
  for ( i = 0;i < v;i++){
    printf("insert");
    scanf("%d",&*[i]);

  
  }
  printf("print\n");



  for (i = 0;i < v; i++){
    printf("%d",insert(T[i],T[i+1]));
    printf("%d",T[i]);
    
}
void insert(search *T, search z){
    y = NULL; // x の親
  x = T[0];
  while (x ≠ NULL){
    y = x; // 親を設定
    if (z.key < x.key)
      x = x.left; // 左の子へ移動
    else 
      x = x.right; // 右の子へ移動
  }
  z.p = y;

  if( y == NULL) // T が空の場合
    T[0] = z;
  else if (z.key < y.key)
    y.left = z; // z を y の左の子にする
  else 
    y.right = z; // z を y の右の子にする
}

Compiler output:
main.c:14:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'x'
   14 |   search x,y,*T;
      |          ^
main.c: In function 'main':
main.c:22:18: error: expected expression before '[' token
   22 |     scanf("%d",&*[i]);
      |                  ^
main.c:31:24: error: 'T' undeclared (first use in this function)
   31 |     printf("%d",insert(T[i],T[i+1]));
      |                        ^
main.c:31:24: note: each undeclared identifier is reported only once for each function it appears in
main.c:35:13: error: unknown type name 'search'
   35 | void insert(search *T, search z){
      |             ^~~~~~
main.c:35:24: error: unknown type name 'search'
   35 | void insert(search *T, search z){
      |                        ^~~~~~
main.c:38:12: error: stray '\342' in program
   38 |   while (x <U+2260> NULL){
      |            ^~~~~~~~
main.c:53:1: error: expected declaration or statement at end of input
   53 | }
      | ^
Language: C

#include <stdio.h>

#define MAX 100000


int insert(int*, int );
struct search{
  int right;
  int left;
  int p;
  int key;
}

  search x,y,*T;

int main(){
  int i,v;

  scanf("%d",&v);
  for ( i = 0;i < v;i++){
    printf("insert");
    scanf("%d",&T[i]);

  
  }
  printf("print\n");



  for (i = 0;i < v; i++){
    insert(T[i],T[i+1]);
    printf("%d",T[i]);
   
}
void insert(search *T, search z){
    y = NULL; // x の親
  x = T[0];
  while (x ≠ NULL){
    y = x; // 親を設定
    if (z.key < x.key)
      x = x.left; // 左の子へ移動
    else 
      x = x.right; // 右の子へ移動
  }
  z.p = y;

  if( y == NULL) // T が空の場合
    T[0] = z;
  else if (z.key < y.key)
    y.left = z; // z を y の左の子にする
  else 
    y.right = z; // z を y の右の子にする
}

Compiler output:
main.c:14:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'x'
   14 |   search x,y,*T;
      |          ^
main.c: In function 'main':
main.c:22:17: error: 'T' undeclared (first use in this function)
   22 |     scanf("%d",&T[i]);
      |                 ^
main.c:22:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:35:13: error: unknown type name 'search'
   35 | void insert(search *T, search z){
      |             ^~~~~~
main.c:35:24: error: unknown type name 'search'
   35 | void insert(search *T, search z){
      |                        ^~~~~~
main.c:38:12: error: stray '\342' in program
   38 |   while (x <U+2260> NULL){
      |            ^~~~~~~~
main.c:53:1: error: expected declaration or statement at end of input
   53 | }
      | ^
Language: C

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
 
struct Node{
  int key;
 struct Node *right, *left, *parent;
};
 
struct Node *root, *Nil;
 
void insert(int);
void inorder(struct Node *);
void preorder(struct Node *);
 
int main(){
  int n, i, x;
  char s[20];
 
  scanf("%d", &n);
 
  for(i=0; i<n; i++){
    scanf("%s", s);

    if(strcmp(s, "insert")==0){
      scanf("%d", &x);
      insert(x);
    }
    else if(strcmp(s, "print")==0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
 
  return 0;
}
 
void insert(int k){
  struct Node *y = Nil, *x = root,*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(struct Node *u){
 
  if(u == Nil) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
 
void preorder(struct Node *u){
 
  if(u == Nil) return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}
 

Compiler output:
main.c: In function 'insert':
main.c:55:11: error: 'NIL' undeclared (first use in this function); did you mean 'Nil'?
   55 |   if(y == NIL)root = z;
      |           ^~~
      |           Nil
main.c:55:11: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#include<stdlib.h>

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

Node root;



Node insert(Node z){

  Node x,y,root;


  y=NIL;
  x=root;
  while(x!=NIL){
    y=x;
    if(z.key<x.key)
      x=x.left;
    else x=x.right;

    z.p=y;
 
    if(y=NIL)
      root=z;
    else if(z.key<y.key)
      y.key=z;
    else y.right = z;
  }


   






int main(){

Compiler output:
main.c: In function 'insert':
main.c:26:9: error: 'z' is a pointer; did you mean to use '->'?
   26 |     if(z.key<x.key)
      |         ^
      |         ->
main.c:26:15: error: 'x' is a pointer; did you mean to use '->'?
   26 |     if(z.key<x.key)
      |               ^
      |               ->
main.c:27:10: error: 'x' is a pointer; did you mean to use '->'?
   27 |       x=x.left;
      |          ^
      |          ->
main.c:28:13: error: 'x' is a pointer; did you mean to use '->'?
   28 |     else x=x.right;
      |             ^
      |             ->
main.c:30:6: error: 'z' is a pointer; did you mean to use '->'?
   30 |     z.p=y;
      |      ^
      |      ->
main.c:34:14: error: 'z' is a pointer; did you mean to use '->'?
   34 |     else if(z.key<y.key)
      |              ^
      |              ->
main.c:34:20: error: 'y' is a pointer; did you mean to use '->'?
   34 |     else if(z.key<y.key)
      |                    ^
      |                    ->
main.c:35:8: error: 'y' is a pointer; did you mean to use '->'?
   35 |       y.key=z;
      |        ^
      |        ->
main.c:36:11: error: 'y' is a pointer; did you mean to use '->'?
   36 |     else y.right = z;
      |           ^
      |           ->
main.c: In function 'main':
main.c:47:1: error: expected declaration or statement at end of input
   47 | int main(){
      | ^~~
main.c: In function 'insert':
main.c:47:1: error: expected declaration or statement at end of input
Language: C

#include<stdio.h>
#include<stdlib.h>
#define NIL NULL
 
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
 
Node root=NIL;
 
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
 
  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  pz->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 m, i, x;
  char str[20];

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

Compiler output:
main.c: In function 'insert':
main.c:23:3: error: 'pz' undeclared (first use in this function); did you mean 'z'?
   23 |   pz->right = NIL;
      |   ^~
      |   z
main.c:23:3: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

struct Node{
  int key;
  struct Node *right, *left, *parent;
};

struct Node *root,*NIL;

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

int main(){
  int m,i,z;
  char *s;
  scanf("%d",&m);

  for(i=0; i<m; i++){
    scanf("%s",s);
    if(strcmp(s,"insert") == 0){
      scanf("%d",&z);
      insert(z);
    }
    else if(strcmp(s,"print") == 0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}

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

  z = (struct Node *)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;
    }
  }
}

Compiler output:
/usr/bin/ld: /tmp/ccTOiF4F.o: in function `main':
main.c:(.text+0xb0): undefined reference to `inorder'
/usr/bin/ld: main.c:(.text+0xc9): undefined reference to `preorder'
collect2: error: ld returned 1 exit status
Language: C

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

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

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

int main()
{
  int m,k,i;
  char str[10];

  scanf("%d",&m);

  for(i = 0; i < m; i++){
    scanf("%s",str);

    if(str[0] == 'i') {
      scanf("%d",&k);
      insert(k);
    }
    else {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}

void insert(int z){
   Node x,y,a;

  y = NIL;
  x = root;
  a = malloc(sizeof(struct node));

  a->key = z;
  a->l = NIL;
  a->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 = a;
    else if(z->key < y->key) y->l = a;
    else y->r = a;
  }
}

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

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

Compiler output:
main.c: In function 'insert':
main.c:53:9: error: invalid type argument of '->' (have 'int')
   53 |     if(z->key < x->key) x = x->l;
      |         ^~
main.c:56:6: error: invalid type argument of '->' (have 'int')
   56 |     z->p = y;
      |      ^~
main.c:59:14: error: invalid type argument of '->' (have 'int')
   59 |     else if(z->key < y->key) y->l = a;
      |              ^~
main.c: In function 'inorder':
main.c:69:3: error: implicit declaration of function 'inorde'; did you mean 'inorder'? [-Wimplicit-function-declaration]
   69 |   inorde(root->r);
      |   ^~~~~~
      |   inorder
Language: C

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

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

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

int main()
{
  int m,k,i;
  char str[10];

  scanf("%d",&m);

  for(i = 0; i < m; i++){
    scanf("%s",str);

    if(str[0] == 'i') {
      scanf("%d",&k);
      insert(k);
    }
    else {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}

void insert(int z){
   Node x,y,a;

  y = NIL;
  x = root;
  a = malloc(sizeof(struct node));

  a->key = z;
  a->l = NIL;
  a->r = NIL;

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

    a->p = y;

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

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

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

Compiler output:
main.c: In function 'inorder':
main.c:69:3: error: implicit declaration of function 'inorde'; did you mean 'inorder'? [-Wimplicit-function-declaration]
   69 |   inorde(root->r);
      |   ^~~~~~
      |   inorder
Language: C

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

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

Node root;

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

int main()
{
  int m,k,i;
  char str[10];

  scanf("%d",&m);

  for(i = 0; i < m; i++){
    scanf("%s",str);

    if(str[0] == 'i') {
      scanf("%d",&k);
      insert(k);
    }
    else {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}

void insert(int z){
   Node x,y,a;

  y = NIL;
  x = root;
  a = malloc(sizeof(struct node));

  a->key = z;
  a->l = NIL;
  a->r = NIL;

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

    a->p = y;

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

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

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

Compiler output:
main.c: In function 'inorder':
main.c:70:3: error: implicit declaration of function 'inorde'; did you mean 'inorder'? [-Wimplicit-function-declaration]
   70 |   inorde(root->r);
      |   ^~~~~~
      |   inorder
Language: C

# define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>

typedef struct node {
	int key;
	struct node *p_left;
	struct node *p_right;
	struct node *p_parent;
}NODE;

void insert(int value);	/* ?????\ */
void inorder(NODE *p_node);	/* ??????????????? */
void preorder(NODE *p_node); /* ??????????????? */

NODE *p_root;

int main(void) {

	char command[20];
	int value;
	int n;
	int i;

	scanf("%d", &n);

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

void insert(int value) {
	NODE *x = p_root;	/* ??? */
	NODE *y = NULL;	/* x?????? */

	NODE *z = (NODE *)malloc(sizeof(NODE));
	z->key = value;
	z->p_left = NULL;
	z->p_right = NULL;

	while (x != NULL) {
		y = x;
		if (z->key < x->key) {
			x = x->p_left;		/* ?????????????§???? */
		}
		else {
			x = x->p_right;	/* ?????????????§???? */
		}
	}
	z->p_parent = y;

	if (y == NULL) {	/* ??¨???????????´??? */
		p_root = z;
	}
	else if (z->key < y->key) {
		y->p_left = z;	//z?????????????????????
	}
	else {
		y->p_right = z;	//z?????????????????????
	}
}

//?????????????????§??¨???
void inorder(NODE *p_node) {

	if (p_node == NULL) {
		return;
	}
	inorder(p_node->p_left);
	printf(" %d", p_node->key);
	inorder(p_node->p_right);
}

//?????????????????§??¨???
void preorder(NODE *p_node) {

	if (p_node == NULL) {
		return;
	}
	printf(" %d", p_node->key);
	preorder(p_node->p_left);
	prerder(p_node->p_right);
}

Compiler output:
main.c: In function 'preorder':
main.c:93:9: error: implicit declaration of function 'prerder'; did you mean 'preorder'? [-Wimplicit-function-declaration]
   93 |         prerder(p_node->p_right);
      |         ^~~~~~~
      |         preorder
Language: C

#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
 
using namespace std;
 
struct Node {
    int left;
    int right;
};
 
Node T[500000];
int root = -1;
 
void printInOrder(int i) {
    if (i == -1) {
        return;
    }
    printInOrder(T[i].left);
    printf(" %d", i);
    printInOrder(T[i].right);
}
 
void printPreOrder(int i) {
    if (i == -1) {
        return;
    }
    printf(" %d", i);
    printPreOrder(T[i].left);
    printPreOrder(T[i].right);
}
 
void insert(int i) {
    T[i].left = T[i].right = -1;
 
    if (root == -1) {
        root = i;
        return;
    }
 
    int y;
    int x = root;
    while (x != -1) {
        y = x;
        if (i < x) {
            x = T[x].left;
        }
        else {
            x = T[x].right;
        }
    }
    if (i < y) {
        T[y].left = i;
    }
    else {
        T[y].right = i;
    }
}
 
int main() {
    int m;
    scanf("%d", &m);
 
    char s[19];
    for (int i = 0; i < m; i++) {
        scanf("%s", s);
 
        if (s[0] == 'i') {
            scanf("%s", s);
            insert(atoi(s));
        }
        else {
            printInOrder(root);
            printf("\n");
            printPreOrder(root);
            printf("\n");
        }
    }
 
    return 0;
}

Compiler output:
main.c:2:10: fatal error: cstdio: No such file or directory
    2 | #include <cstdio>
      |          ^~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
#include<stdlib.h>
 
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL
 
Node root;
 
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 x){
  if(x!=NIL){
    inorder(x->left);
    printf(" %d",x->key);
    inorder(x->right);
  }
}
 
void preorder(Node x){
  if(x!=NIL){
    printf(" %d",x->key);
    preorder(x->left);
    preorder(x->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] == '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:83:3: error: expected identifier or '(' before 'return'
   83 |   return 0;
      |   ^~~~~~
main.c:84:1: error: expected identifier or '(' before '}' token
   84 | }
      | ^
Language: C

#include<stdio.h>
#include<stdlib.h>
 
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL
 
Node root;
 
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 x){
  if(x!=NIL){
    inorder(x->left);
    printf(" %d",x->key);
    inorder(x->right);
  }
}
 
void preorder(Node x){
  if(x!=NIL){
    printf(" %d",x->key);
    preorder(x->left);
    preorder(x->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] == '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:84:3: error: expected identifier or '(' before 'return'
   84 |   return 0;
      |   ^~~~~~
main.c:85:1: error: expected identifier or '(' before '}' token
   85 | }
      | ^
Language: C

#include <stdio.h>
#include <stdlib.h>

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

void insert(int k) {
  Node x = root;
  Node y = NULL;
  Node z;
  z->key = k;
  z->right = NULL;
  z->left = NULL;

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

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

void preorder(Node n) {
  if (n == NULL) return;
  printf("%d ", n->key);
  preorder(n->left);
  preorder(n->right);
}

void inorder(Node n) {
  if (n == NULL) return;
  inorder(n->left);
  printf("%d ", n->key);
  inorder(n->right);
}

int searchTree(Node n, int k) {
  if (n->key == k) return 1;
  if (n->right == NULL && n->left == NULL) return 0;
  searchTree(n->right, k);
  searchTree(n->left, k);
}

int main() {
  int n, i, k;
  char str[10];
  Node z;

  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%s %d\n", str, &k);
    if (str[0] == 'p')
      preorder(root);
      inorder(root);
    } else if (str[0] == 'f'){
      if (searchTree(root, k) == 1) printf("yes\n");
      else printf("no\n");
    } else {
      insert(k);
    }
  }

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:65:7: error: 'else' without a previous 'if'
   65 |     } else if (str[0] == 'f'){
      |       ^~~~
main.c: At top level:
main.c:73:3: error: expected identifier or '(' before 'return'
   73 |   return 0;
      |   ^~~~~~
main.c:74:1: error: expected identifier or '(' before '}' token
   74 | }
      | ^
Language: C

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

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

typedef struct node* node;

void insert(int);
void inorder(node);
void preorder(node);

node tree;

int main(){
  int a,b,i;
  char hairetu[10];
  
  scanf("%d",&a);

  for(i=0;i<a;i++){
    scanf("%s",hairetu);
    if(a[0]=='i'){
      scanf("%d",&b);
      insert(b);
    }
    else if(hairetu[0]=='p'){
      inorder(tree);
      printf("\n");
      preorder(tree);
      printf("\n");
    }
  }

  return 0;
}

void insert(int k){
  
  node y = NIL;
  node x = tree;
  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){
    tree=z;
  }
  else if(z->key < y->key){
    y->left = z;
  }
  else{
    y->right = z;
  }
}

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

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

Compiler output:
main.c: In function 'main':
main.c:28:9: error: subscripted value is neither array nor pointer nor vector
   28 |     if(a[0]=='i'){
      |         ^
Language: C

#include<stdio.h>
#include<stdlib.h>

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

Node root;

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] == '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:35:1: error: expected identifier or '(' before '}' token
   35 | }
      | ^
Language: C

#include <stdio.h>
#include <stdlib.h>
   
typedef struct{
    int key;
    int left;
    int right;
} Node;
   
void insert(Node*, int, int);
void print1(Node*, int);
void print2(Node*, int);
   
int main()
{
    char s[10];
    Node *t;
    int m;
    int a;
    int i;
   
    scanf("%d", &m);
    t=(Node*)malloc(sizeof(Node)*m);
   
    int count=0;
    for(i=0; i<m; i++){
        scanf("%s", &s);
        if(s[0]=='i'){ scanf("%d", &a); insert(t, count, a); count++; }
        if(s[0]=='p'){
            if(count>0) print1(t, 0);
            printf("\n");
            if(count>0) print2(t, 0);
            printf("\n");
        }
    }
       
    return 0;
   
}
   
void print1(Node *t, int p)
{
    if(t[p].left>=0) print1(t, t[p].left);
    printf(" %d", t[p].key);
    if(t[p].right>=0) print1(t, t[p].right);
}
   
void print2(Node *t, int p)
{
    printf(" %d", t[p].key);
    if(t[p].left>=0) print2(t, t[p].left);
    if(t[p].right>=0) print2(t, t[p].right);
}
   
void insert(Node *t, int count, int z)
{
    int x=0, y;
    if(count<1) x=-1;
   
    t[count].key = z;
    t[count].left = -1;
    t[count].right= -1;
   
    while(x>=0){
        y = x; 
        if(z < t[x].key)
            x = t[x].left; 
        else
            x = t[x].right; 
    }
   
    if(count<1){}
    else if(z < t[y].key){
        t[y].left = count; 
    }
    else {
        t[y].right = count;
    }

Compiler output:
main.c: In function 'insert':
main.c:78:5: error: expected declaration or statement at end of input
   78 |     }
      |     ^
Language: C

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define N 500000

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

struct Node *NIL,*root;

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


int main()??{
    int n,x,i;
    char com[N][10];
    
    scanf("%d",&n);
    
    for(i=0; i<n; i++) {
        scanf("%s",com[i]);
        
        if(strcmp(com[i],"insert")==0) {
            scanf("%d",&x);
            insert(x);
        }
        if(strcmp(com[i],"print")==0) {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }
    
    return 0;
}


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


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


void insert(int k) {
    struct Node *y=NIL;
    struct Node *x=root;
    struct Node *z;
    
    z = malloc(sizeof(struct 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;
}

Compiler output:
main.c: In function 'main':
main.c:19:11: error: expected declaration specifiers before '?' token
   19 | int main()??{
      |           ^
main.c:44:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   44 | void inorder(struct Node *x) {
      |                              ^
main.c:53:31: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   53 | void preorder(struct Node *x) {
      |                               ^
main.c:62:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   62 | void insert(int k) {
      |                    ^
main.c:84: error: expected '{' at end of input
Language: C

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define N 500000

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

struct Node *NIL,*root;

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


int main()??{
    int n,x,i;
    char com[N][10];
    
    scanf("%d",&n);
    
    for(i=0; i<n; i++) {
        scanf("%s",com[i]);
        
        if(strcmp(com[i],"insert")==0) {
            scanf("%d",&x);
            insert(x);
        }
        if(strcmp(com[i],"print")==0) {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }
    
    return 0;
}


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


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


void insert(int k) {
    struct Node *y=NIL;
    struct Node *x=root;
    struct Node *z;
    
    z = malloc(sizeof(struct 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;
}

Compiler output:
main.c: In function 'main':
main.c:19:11: error: expected declaration specifiers before '?' token
   19 | int main()??{
      |           ^
main.c:44:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   44 | void inorder(struct Node *x) {
      |                              ^
main.c:53:31: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   53 | void preorder(struct Node *x) {
      |                               ^
main.c:62:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   62 | void insert(int k) {
      |                    ^
main.c:84: error: expected '{' at end of input
Language: C

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

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

Node root;

Node treeMinimum(Node x){

  while (x->left != NIL)
    {
      x = x->left;
    }
  return x;
}

Node treeMaximum(Node x){

  while (x->right != NIL)
    {
      x = x->right;
    }
  return x;
}

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

Node treeSuccessor(Node x){

  if (x->right != NIL)
    return treeMinimum(x->right);
  /*y = x.p;
  while (y != NIL && x == y.right)
    {
      x = y;
      y = y.p;
    }
    return y;*/
}

//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;

  y = NIL;
  x = root;
  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 != NIL) inorderTreeWalk(u->left);
  printf("%d",u->key);
  inorderTreeWalk(u->right);
}
void preorder(Node u){
  if (u == NIL)
    return;
  printf("%d",u);
  preParse(u->left);
  preParse(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");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Compiler output:
main.c: In function 'inorder':
main.c:91:17: error: implicit declaration of function 'inorderTreeWalk' [-Wimplicit-function-declaration]
   91 |   if (u != NIL) inorderTreeWalk(u->left);
      |                 ^~~~~~~~~~~~~~~
main.c: In function 'preorder':
main.c:99:3: error: implicit declaration of function 'preParse' [-Wimplicit-function-declaration]
   99 |   preParse(u->left);
      |   ^~~~~~~~
main.c: In function 'main':
main.c:126:7: error: implicit declaration of function 'treeDelete' [-Wimplicit-function-declaration]
  126 |       treeDelete(treeSearch(root, x));
      |       ^~~~~~~~~~
Language: C

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define MAX 500001


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

struct Node *root, *NIL;

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

z = (struct Node *)malloc(sizeof(struct Node));
z->key = v;
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 Iorder(struct Node *u){
	if(u == NIL){
		return;
	}
	Iorder(u->l);
	printf(" %d", u->key);
	Iorder(u->r);
}
void Porder(struct Node *u){
	if(u == NIL){
		return;
	}
	printf(" %d", u->key);
	Porder(u->l);
	Porder(u->r);
}
int main(){
	int n,i,v;
	char command[6];

	scanf("%d",&n);

	for(i = 0;i <0;i++){
		scanf("%s",command);
		if(command == "insert"){
			scanf("%d", &v);
			insert(v);
		}
		else if(command == "print"){
			Iorder(root);
			printf("\n");
			Porder(root);
			printf("\n");
		}
	}

return 0;

Compiler output:
main.c: In function 'main':
main.c:81:1: error: expected declaration or statement at end of input
   81 | return 0;
      | ^~~~~~