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

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



struct node{
    int me;
    struct node *parent;
    struct node *left;
    struct node *right;
    
};
 struct node *Tree,*END;
int number;

void input(void);
void insert(int n);
void Inorder(struct node *a);
void Preorder(struct node *a);

void input(void){
    char str[100];
    int n;
    int i;
    scanf("%d",&number);
    for(i=0;i<number;i++){
        scanf("%s",str);
        if(strcmp(str,"insert")){
            scanf("%d",&n);
        insert(n);
        }
        else if(strcmp(str,"print")==1){
            Inorder(Tree);
            printf("\n");
            Preorder(Tree);
            printf("\n");
        }
    }
    
    
}

void insert(int n){
    struct node *a=Tree;
    struct node *b=END;
    struct node *c;
    
    c->me=n;
    c->left=END;
    c->right=END;
    
    
    while(b!=END){
        b=a;
        if(c->me < a->me){
            a=a->left;
                    }else {
                        a=a->right;
                    }
                    
                    
    }
    
    c->parent=b;
    if(b==END){
        Tree=c;
        
    }else{
        if(c->me < b-> me){
            b->left=c;
            
            
        }else{
            b->right=c;
        }
        
    }
    
    
    
}

void Inorder(struct node *a){
    if(a==END)return;
    inorder(a->left);
    printf("%d",a->me);
    inorder(a->right);
    
    
}

void Preorder(struct node *a){
    if(a==END)return;
    printf("%d",a->me);
    preorder(a->left);
    preorder(a->right);
    
}


int main(void) {
    
    input();    
	return 0;
	
}




Compiler output:
main.c: In function 'Inorder':
main.c:85:5: error: implicit declaration of function 'inorder'; did you mean 'Inorder'? [-Wimplicit-function-declaration]
   85 |     inorder(a->left);
      |     ^~~~~~~
      |     Inorder
main.c: In function 'Preorder':
main.c:95:5: error: implicit declaration of function 'preorder'; did you mean 'Preorder'? [-Wimplicit-function-declaration]
   95 |     preorder(a->left);
      |     ^~~~~~~~
      |     Preorder
Language: C

#include <iostream>
#include <cstdlib>
using namespace std;

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

Node *root,*NIL;

void insert(int k) {
  Node *y=NIL;
  Node *x=root;
  Node *z;
  z=(Node *)malloc(sizeof(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==NIL) {
    return ;
  }
  inorder(u->left);
  cout<<" "<<u->key<<flush;
  inorder(u->right);
}
void preorder(Node *u) {
  if (u==NIL) {
    return ;
  }
  cout<<" "<<u->key<<flush;
  preorder(u->left);
  preorder(u->right);
}
int main() {
  int n;
  cin>>n;
  for (int i=0; i<n; i++) {
    string com;
    cin>>com;
    if (com=="insert") {
      int x;
      cin>>x;
      insert(x);
    }
    else {
      inorder(root);
      cout<<endl;
      preorder(root);
      cout<<endl;
    }
  }
  return 0;
}



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

#include <bits/stdc++.h>
using namespace std;

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

Node *root, *NIL;

void insert(int a){
  Node *y=NIL, *x=root, *z;
  z = (Node *)malloc(sizeof(Node));
  z->key=a;
  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 *p){
  if(p==NIL) return;
  inorder(p->left);
  cout << " " << p->key;
  inorder(p->right);
}

void preorder(Node *p){
  if(p==NIL) return;
  cout << " " << p->key;
  preorder(p->left);
  preorder(p->right);
}

int main(){
  int n,x;
  string str;

  cin >> n;

  for(int i=0;i<n;i++){
    cin >> str;
    if(str=="insert"){
      cin >> x;
      insert(x);
    }
    else if(str=="print"){
      inorder(root);
      cout << endl;
      preorder(root);
      cout << endl;
    }
  }
  return 0;
}


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
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;
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){
  while(u != NIL && k != u->key)
    {
      if(k < u->key) u = u->left;
      else u = u->right;
      }
  return u;
}

Node treeSuccessor(Node x){
  Node y;
  if(x->right != NIL) return treeMinimum(x->right);
  y = x->parent;
  while(y != NIL && x == y->right){
      x = y;
      y = y->parent;
    }
  return y;
}

void treeDelete(Node x){
  Node y; // node to be deleted
  Node x; // child of y
  if(z->left == NIL || z->right == NIL)
    {
      y = z;
    }
  else
    {
      y = treeSuccessor(z);
    }
  
  if(y->left != NIL)
    {
      x = y->left;
    }
  else
    {
      x = y->right;
    }
  
  if(x != NIL)
    {
      x->parent = y->parent;
    }
  
  if(y->parent == NIL)
    {
      root = x;
    }
  else if(y == y->parent->left)
    {
      y->parent->left = x;
    }
  else
    {
      y->parent->right = x;
    }
  
  if(y != z)
    {
      z->key = y->key;
    }
  free(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(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)
    {
      return;
    }
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}
void preorder(Node u)
{
  if(u == NIL)
    {
      return;
    }
  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] == '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 'treeDelete':
main.c:47:8: error: 'x' redeclared as different kind of symbol
   47 |   Node x; // child of y
      |        ^
main.c:45:22: note: previous definition of 'x' with type 'Node' {aka 'struct node *'}
   45 | void treeDelete(Node x){
      |                 ~~~~~^
main.c:48:6: error: 'z' undeclared (first use in this function)
   48 |   if(z->left == NIL || z->right == NIL)
      |      ^
main.c:48:6: 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 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){
  while(u != NIL && k != u->key)
    {
      if(k < u->key) u = u->left;
      else u = u->right;
    }
  return u;
}

Node treeSuccessor(Node x){
  Node y;
  if(x->right != NIL) return treeMinimum(x->right);
  y = x->parent;
  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  if(z->left == NIL || z->right == NIL) y = z;
  else y = treeSuccessor(z);
  
  if(y->left != NIL)
    {
      x = y->left;
    }else{
    x = y->right;
  }
  
  if(x != NIL) x->parent = y->parent;
  
  if(y->parent == NIL)
    {
      root = x;
    }else{
    if(y == y->parent->left)
      {
	y->parent->left = x;
      }else{
      y->parent->right = x;
    }
  
    if(y != z)
      {
	z->key = y->key;
      }
    free(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(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)
      {
	return;
      }
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
  }
  void preorder(Node u)
  {
    if(u == NIL)
      {
	return;
      }
    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] == '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 'treeDelete':
main.c:167:3: error: expected declaration or statement at end of input
  167 |   }
      |   ^
Language: C

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

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

Node root,NIL;
int max;

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

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

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

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

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

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

int main(){
  int l, i, s;
  char M[20];
  scanf("%d",&l);
  max = 0;
  for (i=0 ; i<l ; i++){
    scanf("%s", M);
    if (strcmp(M,"insert") == 0){
      scanf("%d",&s);
      insert(s);
    }
    else if (strcmp(M,"print") == 0){
      in(root);
      printf("\n");
      out(root);
      printf("\n");
    }
  }

  return 0;
}



Compiler output:
main.c: In function 'in':
main.c:54:3: error: implicit declaration of function 'inorder' [-Wimplicit-function-declaration]
   54 |   inorder(n->right);
      |   ^~~~~~~
main.c: In function 'main':
main.c:71:9: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
   71 |     if (strcmp(M,"insert") == 0){
      |         ^~~~~~
main.c:3:1: note: include '<string.h>' or provide a declaration of 'strcmp'
    2 | #include <stdlib.h>
  +++ |+#include <string.h>
    3 |
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define A 10
#define B 6
#define C 5
#define O 0

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

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

int main(){
  int n,i,x;
  char *com,*comI,*comP;

  com=(char*)malloc(A*sizeof(char));
  comI="insert";
  comP="print";
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",com);
    if(strncmp(com,comI,B)==O){
      scanf("%d",&x);
      insert(x);
    }
    else if(strncmp(com,comP,C)==O){
      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;
    }
  }
}

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:
/usr/bin/ld: /tmp/cc5w8vAB.o: in function `main':
main.c:(.text+0xab): undefined reference to `insert'
collect2: error: ld returned 1 exit status
Language: C

#include <iostream>
#include <cstdlib>
using namespace std;

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

Node *root,*NIL;

void insert(int k) {
  Node *y=NIL;
  Node *x=root;
  Node *z;
  z=(Node *)malloc(sizeof(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==NIL) 
    return ;
  
  inorder(u->left);
  cout<<" "<<u->key<<flush;
  inorder(u->right);
}
void preorder(Node *u) {
  if (u==NIL) {
    return ;
  }
  cout<<" "<<u->key<<flush;
  preorder(u->left);
  preorder(u->right);
}
int main() {
  int n;
  cin>>n;
  for (int i=0; i<n; i++) {
    string com;
    cin>>com;
    if (com=="insert") {
      int x;
      cin>>x;
      insert(x);
    }
    else {
      inorder(root);
      cout<<endl;
      preorder(root);
      cout<<endl;
    }
  }
  return 0;
}


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

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

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

struct node *root;
struct node *NIL;

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

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);
}

int main(){

  int n,i,x;
  char *com;
  char *cominsert = "insert";
  char *comprint = "print";

  com = (char*)malloc(10*sizeof(char));  
  
  scanf("%d", &n);

  for(i=0; i<n; i++){
    scanf("%s", com);
  
    if(strncmp(com,cominsert,6)==0){
      scanf("%d",&x);
      insert(x);
    }
    else if(strncmp(com,comprint,5)==0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}



Compiler output:
main.c: In function 'inorder':
main.c:51:8: error: invalid operands to binary == (have 'struct node' and 'struct node *')
   51 |   if(u == NIL) {
      |        ^~
main.c:54:12: error: invalid type argument of '->' (have 'struct node')
   54 |   inorder(u->left);
      |            ^~
main.c:55:18: error: invalid type argument of '->' (have 'struct node')
   55 |   printf(" %d", u->key);
      |                  ^~
main.c:56:12: error: invalid type argument of '->' (have 'struct node')
   56 |   inorder(u->right);
      |            ^~
main.c: In function 'main':
main.c:87:15: error: incompatible type for argument 1 of 'inorder'
   87 |       inorder(root);
      |               ^~~~
      |               |
      |               struct node *
main.c:50:26: note: expected 'struct node' but argument is of type 'struct node *'
   50 | void inorder(struct node u){
      |              ~~~~~~~~~~~~^
Language: C

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



Compiler output:
main.c: In function 'main':
main.c:50:3: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'scanf'
   50 |   scanf("%d",&k);
      |   ^~~~~
main.c:53:16: error: 'com' undeclared (first use in this function)
   53 |     scanf("%s",com);
      |                ^~~
main.c:53:16: 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;

Node root, NIL;
int maxh;

void insert(int k){
  int H;
  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==NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

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

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



Compiler output:
main.c: In function 'main':
main.c:66:8: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
   66 |     if(strcmp(com,"insert")==0){
      |        ^~~~~~
main.c:3:1: note: include '<string.h>' or provide a declaration of 'strcmp'
    2 | #include<stdlib.h>
  +++ |+#include <string.h>
    3 | struct node{
main.c:74:7: error: implicit declaration of function 'orintf'; did you mean 'printf'? [-Wimplicit-function-declaration]
   74 |       orintf("\n");
      |       ^~~~~~
      |       printf
Language: C

#include <stdio.h>
#include <stdlib.h>
#define N 5001

typedef struct tree{
  int key;
  struct tree *parent;
  struct tree *left;
  struct tree *right;
} Tree;

void insert(int);
void inorderwalk(Tree *);
void preorderwalk(Tree *);

Tree *t;

int main(){
  int m, x[N], i, j;
  char order[N][7];

  scanf("%d", &m);
  for(i = 0; i < m; i++){
    scanf("%s", order[i]);
    if(order[i][0] == 'i') scanf("%d", &x[i]);
    else x[i] = -1;
  }

  t = (Tree *)malloc( sizeof(Tree) );

  for(i = 0; i < m; i++){
    if(order[i][0] == 'i' && i == 0) t->key = x[i];
    else if(order[i][0] == 'i'){
      insert(t, x[i]);
    }
    else{
      inorderwalk(t);
      printf("\n");
      preorderwalk(t);
      printf("\n");
    }
  }

  return 0;
}

void insert(int key){
  Tree *x, *y, *z;

  z = (Tree *)malloc( sizeof(Tree) );
  z->key = key;

  y = NULL;
  x = t;

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

  z->parent = y;

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

void inorderwalk(Tree *x){

    if(x->left != NULL) inorderwalk(x->left);
    printf(" %d",x->key);
    if(x->right != NULL) inorderwalk(x->right);
}

void preorderwalk(Tree *x){

  printf(" %d",x->key);
  if(x->left != NULL) preorderwalk(x->left);
  if(x->right != NULL) preorderwalk(x->right);
}

Compiler output:
main.c: In function 'main':
main.c:34:14: error: passing argument 1 of 'insert' makes integer from pointer without a cast [-Wint-conversion]
   34 |       insert(t, x[i]);
      |              ^
      |              |
      |              Tree * {aka struct tree *}
main.c:12:13: note: expected 'int' but argument is of type 'Tree *' {aka 'struct tree *'}
   12 | void insert(int);
      |             ^~~
main.c:34:7: error: too many arguments to function 'insert'
   34 |       insert(t, x[i]);
      |       ^~~~~~
main.c:12:6: note: declared here
   12 | void insert(int);
      |      ^~~~~~
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#define N 501

typedef struct tree{
  int key;
  struct tree *parent;
  struct tree *left;
  struct tree *right;
} Tree;

Tree *createtree(int);
void insert(Tree *, int);
void inorderwalk(Tree *);
void preorderwalk(Tree *);

int main(){
  Tree *t;
  int m, x[N], i, j;
  char order[N][7];

  scanf("%d", &m);
  for(i = 0; i < m; i++){
    scanf(" %s", order[i]);
    if(order[i][0] == 'i') scanf("%d", &x[i]);
  }

  for(i = 0; i < m; i++){
    if(order[i][0] == 'i' && i == 0) t = createtree(x[i]);
    else if(order[i][0] == 'i'){
      insert(t, x[i]);
    } 
    else{
      assert(t!==NULL);
      inorderwalk(t);
      printf("\n");
      preorderwalk(t);
      printf("\n");
    }
   
  }

  free(t);

  return 0;
}

void insert(Tree *t, int key){
  Tree *x, *y, *z;

  z = createtree(key);

  y = NULL;
  x = t;

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

  z->parent = y;

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

void inorderwalk(Tree *x){
  if(x==NULL)return;
    if(x->left != NULL) inorderwalk(x->left);
    printf(" %d",x->key);
    if(x->right != NULL) inorderwalk(x->right);
}

void preorderwalk(Tree *x){
  if(x==NULL)return;
  printf(" %d",x->key);
  if(x->left != NULL) preorderwalk(x->left);
  if(x->right != NULL) preorderwalk(x->right);
}

Tree *createtree(int key){
  Tree *tree = (Tree *)malloc( sizeof(Tree) );
  tree->key = key;
  tree->parent = NULL;
  tree->left = NULL;
  tree->right = NULL;
}

Compiler output:
In file included from main.c:3:
main.c: In function 'main':
main.c:35:17: error: expected expression before '=' token
   35 |       assert(t!==NULL);
      |                 ^
Language: C

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

struct Node{
  int key;
  struct Node* parent; //親
  struct Node* left; //左の子
  struct Node* right; //右の子
};

typedef struct Node node;

node* insert(node* r, int k) {
  node* x = r;
  node* y = NULL;
  node* z = (node*)malloc( sizeof(node) );
  z->key = k;
  z->left = NULL;
  z->right = NULL;
  z->parent = NULL;

  while( x != NULL) {
    y = x;

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

  }
  z->parent = y;

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

  return r;

}


void printInorder(node* r) { //左->自身->右
  
  if(r->left != NULL) {
    printInorder( r->left );
  }

  printf(" %d", r->key);

  if(r->right != NULL) {
    printInorder( r->right );
  }

}


void printPreorder(node* r) {

  printf(" %d", r->key);

  if(r->left != NULL) {
    printPreorder( r->left );
  }

  if(r->right != NULL) {
    printPreorder( r->right );
  }

}


main() {

  int m, k;
  node* r = NULL;
  char o[10];
  int i;

  //命令の数を取得
  scanf("%d", &m);

  for( i=0; i<m; i++) {

    //命令を取得
    scanf("%s", o);

    if(!strcmp( o, "insert")) { //挿入
      scanf("%d", &k);
      //printf("?");
      //fflush(stdout);
      r = insert( r, k);
      //printf("!");
      //fflush(stdout);
    }

    if(!strcmp( o, "print")) { //出力
      printInorder( r );
      printf("\n");

      printPreorder( r );
      printf("\n");
    }


  }

  return 0;

}

insert 22
insert 1
insert 10
insert 9
insert 15
insert 13
print

Compiler output:
main.c:78:1: error: return type defaults to 'int' [-Wimplicit-int]
   78 | main() {
      | ^~~~
main.c:117:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before numeric constant
  117 | insert 22
      |        ^~
Language: C

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
 
using namespace std;
 
struct node {
  int key;
  node *lp,*rp;
 
  node(){}
  node(int z):key(z),lp(NULL),rp(NULL){}
 
} *root;
 
void insert(node* z){
  node *x=root,*y=NULL;
 
  while(x){
    y = x;
    x = (z->key < x->key) ? x->lp : x->rp;
  }
 
  if(!y)root = z;
  else (z->key < y->key ? y->lp : y->rp) = z;
}
 
vector<int> preorder, inorder;
 
int dfs(node *t = root){
  preorder.push_back(t->key);
  if(t->lp)dfs(t->lp);
  inorder.push_back(t->key);
  if(t->rp)dfs(t->rp);
}
 
int main(void) {
 
  root = NULL;
 
  int n,v;
  string s;
  cin >> n;
 
  for(int i=0,m=0;i<n;i++){
    cin >> s;
    if(s=="insert"){
      cin >> v;
      insert(new node(v));
      m++;
    } else {
      dfs();
      for(int j=0;j<m;j++)cout << " " << inorder[j];
      cout << endl;
      for(int j=0;j<m;j++)cout << " " << preorder[j];
      cout << endl;
 
      preorder.clear();
      inorder.clear();
    }
  }
 
  return 0;
}

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

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
struct Node{
  int key;
  struct Node* p;
  struct Node* l;
  struct Node* r;
};
 
typedef struct Node node;
 
node* insert(node* r, int k) {
  node* x = r;
  node* y = NULL;
  node* z = (node*)malloc( sizeof(node) );
  z->key = k;
  z->l = NULL;
  z->r = NULL;
  z->p = NULL;
 
  while(x != NULL) {
    y = x;
 
    if(z->key < x->key) {
      x = x->l;
    }else {
      x = x->r;
    }
 
  }
  z->parent = y;
 
  if(y == NULL) {
    r = z;
  }else if(z->key < y->key) {
    y->l = z;
  }else {
    y->r = z;
  }
 
  return r;
 
}
 
 
void printInorder(node* r) { 
   
  if(r->left != NULL) {
    printInorder(r->left);
  }
 
  printf(" %d", r->key);
 
  if(r->r != NULL) {
    printInorder(r->r);
  }
 
}
 
 
void printPreorder(node* r) {
 
  printf(" %d", r->key);
 
  if(r->l != NULL) {
    printPreorder(r->l);
  }
 
  if(r->r != NULL) {
    printPreorder(r->r);
  }
 
}
 
 
main() {
 
  int m, k;
  node* r = NULL;
  char o[10];
  int i;
 
  scanf("%d", &m);
 
  for(i=0; i<m; i++) {
 
    scanf("%s", o);
 
    if(!strcmp(o, "insert")) { 
      scanf("%d", &k);
   
      r = insert(r, k);
   
    }
 
    if(!strcmp(o, "print")) {
      printInorder(r);
      printf("\n");
 
      printPreorder(r);
      printf("\n");
    }
 
 
  }
 
  return 0;
 
}

Compiler output:
main.c: In function 'insert':
main.c:33:4: error: 'node' {aka 'struct Node'} has no member named 'parent'
   33 |   z->parent = y;
      |    ^~
main.c: In function 'printInorder':
main.c:50:7: error: 'node' {aka 'struct Node'} has no member named 'left'
   50 |   if(r->left != NULL) {
      |       ^~
main.c:51:19: error: 'node' {aka 'struct Node'} has no member named 'left'
   51 |     printInorder(r->left);
      |                   ^~
main.c: At top level:
main.c:78:1: error: return type defaults to 'int' [-Wimplicit-int]
   78 | main() {
      | ^~~~
Language: C

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

struct node{
  struct node *left;
  struct node *right;
  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){
    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 n){
  if(n != NIL){
    if(n->left != NIL) inorder(n->left);
    printf(" %d", p->key);
    if(n->right != NIL) inorder(n->right);
  }
}

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


int main(){
  int i, x, n;
  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 'inorder':
main.c:43:19: error: 'p' undeclared (first use in this function)
   43 |     printf(" %d", p->key);
      |                   ^
main.c:43:19: 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 treeMinimum(Node x){
??
??
}
??
Node treeSearch(Node u, int k){
??
??
}
??
Node treeSuccessor(Node x){
??
??
}
*/
??
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;
????int i;
??
??
????for(i=0;x != NIL;i++){
????????y=x;
??
????????if(z->key < x->key){
????????????x=x->left;
????????}
????????else x=x->right;
????}
??
????z->parent=y;
??
??
????if(y==NIL){
????????/*
????????????root=x;
????????*/
????????root=z;
????}
??
????else if(z->key < y->key) y->left=z;
????else 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] == '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:3:1: error: expected identifier or '(' before '?' token
    3 | ??
      | ^
main.c:12:1: error: expected identifier or '(' before '?' token
   12 | ??
      | ^
main.c:30:1: error: expected identifier or '(' before '?' token
   30 | ??
      | ^
main.c:35:1: error: expected identifier or '(' before '?' token
   35 | ??
      | ^
main.c:40:1: error: expected identifier or '(' before '?' token
   40 | ??
      | ^
main.c:45:1: error: expected identifier or '(' before '?' token
   45 | ??
      | ^
main.c:54:1: error: expected identifier or '(' before '?' token
   54 | ??
      | ^
main.c:80:7: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
   80 | ????????/*
main.c:92:1: error: expected identifier or '(' before '?' token
   92 | ??
      | ^
main.c: In function 'preorder':
main.c:111:1: error: expected expression before '?' token
  111 | ????if(u != NIL){
      | ^
main.c: At top level:
main.c:119:1: error: expected identifier or '(' before '?' token
  119 | ??
      | ^
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 != 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:3:1: error: expected identifier or '(' before '?' token
    3 | ??
      | ^
main.c:12:1: error: expected identifier or '(' before '?' token
   12 | ??
      | ^
main.c:14:1: error: expected identifier or '(' before '?' token
   14 | ??
      | ^
main.c:47:1: error: expected identifier or '(' before '?' token
   47 | ??
      | ^
main.c: In function 'preorder':
main.c:59:1: error: expected expression before '?' token
   59 | ??
      | ^
main.c: At top level:
main.c:66:1: error: expected identifier or '(' before '?' token
   66 | ??
      | ^
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 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(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 ,int n){
  int i=0;
if(u != NIL){
    inorder(u->left);
    printf("%d ",u->key);  
    if(i<n-1){
        printf(" ");
        i++;
}
    inorder(u->right);
      }
}
void preorder(Node u,int n){
int i=0;
 if(u != NIL){
  printf("%d",u->key);
if(i<n-1){
        printf(" ");
        i++;
}
    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,n);
      printf("\n");
      preorder(root,n);
      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:66:5: error: too few arguments to function 'inorder'
   66 |     inorder(u->left);
      |     ^~~~~~~
main.c:63:6: note: declared here
   63 | void inorder(Node u ,int n){
      |      ^~~~~~~
main.c:72:5: error: too few arguments to function 'inorder'
   72 |     inorder(u->right);
      |     ^~~~~~~
main.c:63:6: note: declared here
   63 | void inorder(Node u ,int n){
      |      ^~~~~~~
main.c: In function 'preorder':
main.c:83:5: error: too few arguments to function 'preorder'
   83 |     preorder(u->left);
      |     ^~~~~~~~
main.c:75:6: note: declared here
   75 | void preorder(Node u,int n){
      |      ^~~~~~~~
main.c:84:5: error: too few arguments to function 'preorder'
   84 |     preorder(u->right);
      |     ^~~~~~~~
main.c:75:6: note: declared here
   75 | void preorder(Node u,int n){
      |      ^~~~~~~~
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 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; // set parent
    if(z->key < x->key){
      x = x.left; // shift to left child
    }
    else{
      x = x->right; // shift to right child
    }
  }
  z->parent = y;

  if(y == NIL){
    root = z; // Tree is empty
  }
  else if(z->key < y->key){
    y.left = z; 
  }
  else{
    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] == '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 'insert':
main.c:53:12: error: 'x' is a pointer; did you mean to use '->'?
   53 |       x = x.left; // shift to left child
      |            ^
      |            ->
main.c:65:6: error: 'y' is a pointer; did you mean to use '->'?
   65 |     y.left = z;
      |      ^
      |      ->
main.c:68:6: error: 'y' is a pointer; did you mean to use '->'?
   68 |     y.right = z;
      |      ^
      |      ->
main.c: In function 'main':
main.c:101:16: error: implicit declaration of function 'treeSearch' [-Wimplicit-function-declaration]
  101 |       Node t = treeSearch(root, x);
      |                ^~~~~~~~~~
main.c:101:16: error: initialization of 'Node' {aka 'struct node *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
main.c:114:7: error: implicit declaration of function 'treeDelete' [-Wimplicit-function-declaration]
  114 |       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 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; // set parent
    if(z->key < x->key){
      x = x->left; // shift to left child
    }
    else{
      x = x->right; // shift to right child
    }
  }
  z->parent = y;

  if(y == NIL){
    root = z; // Tree is empty
  }
  else if(z->key < y->key){
    y->left = z; 
  }
  else{
    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] == '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:101:16: error: implicit declaration of function 'treeSearch' [-Wimplicit-function-declaration]
  101 |       Node t = treeSearch(root, x);
      |                ^~~~~~~~~~
main.c:101:16: error: initialization of 'Node' {aka 'struct node *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
main.c:114:7: error: implicit declaration of function 'treeDelete' [-Wimplicit-function-declaration]
  114 |       treeDelete(treeSearch(root, x));
      |       ^~~~~~~~~~
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);
    
    } 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);
    }
  }

  return 0;
}


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);
}
}

Compiler output:
main.c: In function 'main':
main.c:17:7: error: implicit declaration of function 'insert' [-Wimplicit-function-declaration]
   17 |       insert(x);
      |       ^~~~~~
main.c:19:7: error: implicit declaration of function 'inorder' [-Wimplicit-function-declaration]
   19 |       inorder(root);
      |       ^~~~~~~
main.c:19:15: error: 'root' undeclared (first use in this function)
   19 |       inorder(root);
      |               ^~~~
main.c:19:15: note: each undeclared identifier is reported only once for each function it appears in
main.c:21:7: error: implicit declaration of function 'preorder' [-Wimplicit-function-declaration]
   21 |       preorder(root);
      |       ^~~~~~~~
main.c: At top level:
main.c:45:6: warning: conflicting types for 'insert'; have 'void(int)'
   45 | void insert(int k){
      |      ^~~~~~
main.c:17:7: note: previous implicit declaration of 'insert' with type 'void(int)'
   17 |       insert(x);
      |       ^~~~~~
main.c:87:6: warning: conflicting types for 'inorder'; have 'void(struct node *)'
   87 | void inorder(Node u){
      |      ^~~~~~~
main.c:19:7: note: previous implicit declaration of 'inorder' with type 'void(struct node *)'
   19 |       inorder(root);
      |       ^~~~~~~
main.c:95:6: warning: conflicting types for 'preorder'; have 'void(struct node *)'
   95 | void preorder(Node u){
      |      ^~~~~~~~
main.c:21:7: note: previous implicit declaration of 'preorder' with type 'void(struct node *)'
   21 |       preorder(root);
      |       ^~~~~~~~
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);
    
    } 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);
    }
  }

  return 0;
}


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);
}
}

Compiler output:
main.c: In function 'main':
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:21:15: error: 'root' undeclared (first use in this function)
   21 |       inorder(root);
      |               ^~~~
main.c:21:15: note: each undeclared identifier is reported only once for each function it appears in
main.c:23:7: error: implicit declaration of function 'preorder' [-Wimplicit-function-declaration]
   23 |       preorder(root);
      |       ^~~~~~~~
main.c: At top level:
main.c:47:6: warning: conflicting types for 'insert'; have 'void(int)'
   47 | void insert(int k){
      |      ^~~~~~
main.c:19:7: note: previous implicit declaration of 'insert' with type 'void(int)'
   19 |       insert(x);
      |       ^~~~~~
main.c:89:6: warning: conflicting types for 'inorder'; have 'void(struct node *)'
   89 | void inorder(Node u){
      |      ^~~~~~~
main.c:21:7: note: previous implicit declaration of 'inorder' with type 'void(struct node *)'
   21 |       inorder(root);
      |       ^~~~~~~
main.c:97:6: warning: conflicting types for 'preorder'; have 'void(struct node *)'
   97 | void preorder(Node u){
      |      ^~~~~~~~
main.c:23:7: note: previous implicit declaration of 'preorder' with type 'void(struct node *)'
   23 |       preorder(root);
      |       ^~~~~~~~