Language: C

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

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

int flag = 0;

typedef struct node Node;

Node *root, *NIL;

void Insert(int);
void Inorder(Node *);
void Preorder(Node *);
void Find(Node *, int);

int main()
{
  int n,i,a;
  char in[7],insert[7] = "insert",find[5] = "find",print[6] = "print";
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf(" %s",in);
    if(strcmp(in, insert) == 0) {
      scanf("%d",&a);
      Insert(a);
    }
    else if(strcmp(find, in) == 0) {
      scanf("%d",&a);
      Find(root,a);
      if(flag == 1) printf("yes\n");
      else printf("no\n");
      flag = 0;
    }
    if(strcmp(print, in) == 0) {
      Inorder(root);
      printf("\n");
      Preorder(root);
      printf("\n");
    }
  }
  return 0;
}

void Insert(int a) {
  Node *b = NIL;
  Node *c = root;
  Node *d;

  d = malloc(sizeof(Node));
  d -> key = a;
  d -> left = NIL;
  d -> right = NIL;
  while(c != NIL) {
    b = c;
    if(d -> key < c -> key) c = c -> left;
    else  c = c -> right;
  }

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

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

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

void Find(Node *u, int k) {
    if(u == NIL) return;
  else {
    if(u -> key == k) flag = 1;
    Find(u -> left, k);
    Find(u -> right, k);
  }
}

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | nclude <stdio.h>
      |        ^
In file included from main.c:2:
/usr/include/stdlib.h:98:8: error: unknown type name 'size_t'
   98 | extern size_t __ctype_get_mb_cur_max (void) __THROW __wur;
      |        ^~~~~~
/usr/include/stdlib.h:57:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
   56 | #include <bits/floatn.h>
  +++ |+#include <stddef.h>
   57 | 
/usr/include/stdlib.h:531:25: error: unknown type name 'size_t'
  531 |                         size_t __statelen) __THROW __nonnull ((2));
      |                         ^~~~~~
/usr/include/stdlib.h:531:25: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:561:25: error: unknown type name 'size_t'
  561 |                         size_t __statelen,
      |                         ^~~~~~
/usr/include/stdlib.h:561:25: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:661:42: error: unknown type name 'size_t'
  661 | extern void arc4random_buf (void *__buf, size_t __size)
      |                                          ^~~~~~
/usr/include/stdlib.h:661:42: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:672:22: error: unknown type name 'size_t'
  672 | extern void *malloc (size_t __size) __THROW __attribute_malloc__
      |                      ^~~~~~
/usr/include/stdlib.h:672:22: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:675:22: error: unknown type name 'size_t'
  675 | extern void *calloc (size_t __nmemb, size_t __size)
      |                      ^~~~~~
/usr/include/stdlib.h:675:22: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:675:38: error: unknown type name 'size_t'
  675 | extern void *calloc (size_t __nmemb, size_t __size)
      |                                      ^~~~~~
/usr/include/stdlib.h:675:38: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:683:36: error: unknown type name 'size_t'
  683 | extern void *realloc (void *__ptr, size_t __size)
      |                                    ^~~~~~
/usr/include/stdlib.h:683:36: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:695:41: error: unknown type name 'size_t'
  695 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
      |                                         ^~~~~~
/usr/include/stdlib.h:695:41: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:695:57: error: unknown type name 'size_t'
  695 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
      |                                                         ^~~~~~
/usr/include/stdlib.h:695:57: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:701:41: error: unknown type name 'size_t'
  701 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
      |                                         ^~~~~~
/usr/include/stdlib.h:701:41: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:701:57: error: unknown type name 'size_t'
  701 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
      |                                                         ^~~~~~
/usr/include/stdlib.h:701:57: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
In file included from /usr/include/stdlib.h:706:
/usr/include/alloca.h:32:22: error: unknown type name 'size_t'
   32 | extern void *alloca (size_t __size) __THROW;
      |                      ^~~~~~
/usr/include/alloca.h:25:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
   24 | #include <stddef.h>
  +++ |+#include <stddef.h>
   25 | 
/usr/include/stdlib.h:712:22: error: unknown type name 'size_t'
  712 | extern void *valloc (size_t __size) __THROW __attribute_malloc__
      |                      ^~~~~~
/usr/include/stdlib.h:712:22: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:718:45: error: unknown type name 'size_t'
  718 | extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
      |                                             ^~~~~~
/usr/include/stdlib.h:718:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:718:65: error: unknown type name 'size_t'
  718 | extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
      |                                                                 ^~~~~~
/usr/include/stdlib.h:718:65: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:724:29: error: unknown type name 'size_t'
  724 | extern void *aligned_alloc (size_t __alignment, size_t __size)
      |                             ^~~~~~
/usr/include/stdlib.h:724:29: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:724:49: error: unknown type name 'size_t'
  724 | extern void *aligned_alloc (size_t __alignment, size_t __size)
      |                                                 ^~~~~~
/usr/include/stdlib.h:724:49: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:961:23: error: unknown type name 'size_t'
  961 |                       size_t __nmemb, size_t __size, __compar_fn_t __compar)
      |                       ^~~~~~
/usr/include/stdlib.h:961:23: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:961:39: error: unknown type name 'size_t'
  961 |                       size_t __nmemb, size_t __size, __compar_fn_t __compar)
      |                                       ^~~~~~
/usr/include/stdlib.h:961:39: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:970:34: error: unknown type name 'size_t'
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |                                  ^~~~~~
/usr/include/stdlib.h:970:34: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:970:50: error: unknown type name 'size_t'
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |                                                  ^~~~~~
/usr/include/stdlib.h:970:50: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1044:20: error: unknown type name 'size_t'
 1044 |                    size_t __len) __THROW __nonnull ((3, 4, 5));
      |                    ^~~~~~
/usr/include/stdlib.h:1044:20: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1047:20: error: unknown type name 'size_t'
 1047 |                    size_t __len) __THROW __nonnull ((3, 4, 5));
      |                    ^~~~~~
/usr/include/stdlib.h:1047:20: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1051:45: error: unknown type name 'size_t'
 1051 |                     char *__restrict __buf, size_t __len)
      |                                             ^~~~~~
/usr/include/stdlib.h:1051:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1055:45: error: unknown type name 'size_t'
 1055 |                     char *__restrict __buf, size_t __len)
      |                                             ^~~~~~
/usr/include/stdlib.h:1055:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1062:36: error: unknown type name 'size_t'
 1062 | extern int mblen (const char *__s, size_t __n) __THROW;
      |                                    ^~~~~~
/usr/include/stdlib.h:1062:36: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1066:48: error: unknown type name 'size_t'
 1066 |                    const char *__restrict __s, size_t __n) __THROW;
      |                                                ^~~~~~
/usr/include/stdlib.h:1066:48: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1073:8: error: unknown type name 'size_t'
 1073 | extern size_t mbstowcs (wchar_t *__restrict  __pwcs,
      |        ^~~~~~
/usr/include/stdlib.h:1073:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1074:53: error: unknown type name 'size_t'
 1074 |                         const char *__restrict __s, size_t __n) __THROW
      |                                                     ^~~~~~
/usr/include/stdlib.h:1074:53: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdlib.h:1077:8: error: unknown type name 'size_t'
 1077 | extern size_t wcstombs (char *__restrict __s,
      |        ^~~~~~
/usr/include/stdlib.h:1077:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably