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

#include<stdio.h>
#include<stdlib.h>
#define N 10000
#define NIL NULL
struct node{
  struct node *l;
  struct node *r;
  struct node *p;
  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;
    }
}
*/
//Inorder Walk
void inorder(Node u){
  if(u != NIL){
    inorder(u->left);
    printf(" ");
    printf("%d",u->key);
    inorder(u->right);
  }
 
}
//Preorder Walk
void preorder(Node u){ 
    if (u != NIL) {
      printf(" ");
      printf("%d",u->key); 
      preorder(u->l);
      preorder(u->r);
    
    }
}
int main(void) {
  int i;
  int d;
  n = 25;
  for (i = 0; i < n; i++) T[i].p = T[i].l = T[i].r = NIL;
  for (i = 0; i < n; i++) {
    scanf("%d", &d);
    scanf("%d %d", &T[d].l, &T[d].r);
    T[T[d].l].p = T[T[d].r].p = d;
  }
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'inorder':
main.c:47:14: error: 'struct node' has no member named 'left'
   47 |     inorder(u->left);
      |              ^~
main.c:50:14: error: 'struct node' has no member named 'right'
   50 |     inorder(u->right);
      |              ^~
main.c: In function 'main':
main.c:67:3: error: 'n' undeclared (first use in this function)
   67 |   n = 25;
      |   ^
main.c:67:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:68:27: error: 'T' undeclared (first use in this function)
   68 |   for (i = 0; i < n; i++) T[i].p = T[i].l = T[i].r = NIL;
      |                           ^
main.c: At top level:
main.c:79:3: error: expected identifier or '(' before '}' token
   79 |   }
      |   ^
main.c:80:3: error: expected identifier or '(' before 'return'
   80 |   return 0;
      |   ^~~~~~
main.c:81:1: error: expected identifier or '(' before '}' token
   81 | }
      | ^
Language: C

#include<stdio.h>
#include<stdlib.h>
#define N 10000
#define NIL NULL
struct node{
  struct node *l;
  struct node *r;
  struct node *p;
  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 u){
  if(u != NIL){
    inorder(u->left);
    printf(" ");
    printf("%d",u->key);
    inorder(u->right);
  }
 
}
void preorder(Node u){ 
    if (u != NIL) {
      printf(" ");
      printf("%d",u->key); 
      preorder(u->l);
      preorder(u->r);
    
    }
}
int main(void) {
  int i;
  int d;
  n = 25;
  for (i = 0; i < n; i++) aT[i].p = T[i].l = T[i].r = NIL;
  for (i = 0; i < n; i++) {
    scanf("%d", &d);
    scanf("%d %d", &T[d].l, &T[d].r);
    T[T[d].l].p = T[T[d].r].p = d;
  }
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'inorder':
main.c:45:14: error: 'struct node' has no member named 'left'
   45 |     inorder(u->left);
      |              ^~
main.c:48:14: error: 'struct node' has no member named 'right'
   48 |     inorder(u->right);
      |              ^~
main.c: In function 'main':
main.c:64:3: error: 'n' undeclared (first use in this function)
   64 |   n = 25;
      |   ^
main.c:64:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:65:27: error: 'aT' undeclared (first use in this function)
   65 |   for (i = 0; i < n; i++) aT[i].p = T[i].l = T[i].r = NIL;
      |                           ^~
main.c:65:37: error: 'T' undeclared (first use in this function)
   65 |   for (i = 0; i < n; i++) aT[i].p = T[i].l = T[i].r = NIL;
      |                                     ^
main.c: At top level:
main.c:76:3: error: expected identifier or '(' before '}' token
   76 |   }
      |   ^
main.c:77:3: error: expected identifier or '(' before 'return'
   77 |   return 0;
      |   ^~~~~~
main.c:78:1: error: expected identifier or '(' before '}' token
   78 | }
      | ^
Language: C

#include<stdio.h>
#define MAX 26

struct Node { int v, a, b; };
struct Node T[MAX];
int N,i,l,r,p;
char S[4][100]={"Preorder","Inorder","Postorder"};
void pre(int n)
{
    if(n==-1)return;
    printf(" %d",n);
    pre(G[n].a);
    pre(G[n].b);
    return;
}
 
void ino(int n)
{
    if(n==-1)return;
    ino(G[n].a);
    printf(" %d",n);
    ino(G[n].b);
    return;
}
 
void pos(int n)
{
    if(n==-1)return;
    pos(G[n].a);
    pos(G[n].b);
    printf(" %d",n);
    return;
}
 
 
 
int main()
{
    void (*funcs[])(int)={pre,ino,pos};
    scanf("%d",&N);
    for(i=0;i<N;i++)
    {
        scanf("%d%d%d",&p,&l,&r);
        pc[l]=pc[r]=1;
        G[p].a=l;
        G[p].b=r;
    }
    for(i=0;i<N;i++)if(!G[i].p)p=i;
    for(i=0;i<3;i++)
    {
        puts(S[i]);
        (*(funcs[i]))(p);
        puts("");
    }
    return 0;
}

Compiler output:
main.c: In function 'pre':
main.c:12:9: error: 'G' undeclared (first use in this function)
   12 |     pre(G[n].a);
      |         ^
main.c:12:9: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'ino':
main.c:20:9: error: 'G' undeclared (first use in this function)
   20 |     ino(G[n].a);
      |         ^
main.c: In function 'pos':
main.c:29:9: error: 'G' undeclared (first use in this function)
   29 |     pos(G[n].a);
      |         ^
main.c: In function 'main':
main.c:44:9: error: 'pc' undeclared (first use in this function); did you mean 'p'?
   44 |         pc[l]=pc[r]=1;
      |         ^~
      |         p
main.c:45:9: error: 'G' undeclared (first use in this function)
   45 |         G[p].a=l;
      |         ^
Language: C

#include <stdio.h>
#define nil -1
  
struct Node{
  int y; 
  int l; 
  int r; 
};
  
void preorder(int u);
void inorder(int u);
void postorder(int u);
  
struct Node T[100000];
int n;
  
main(){
  int i,j,v,c,root;
  
  scanf("%d",&n); 
  
  for(i=0;i<n;i++){
    T[i].y=nil;
    T[i].l=nil;
    T[i].r=nil;
  }
  
  for(i=0;i<n;i++){
    scanf("%d",&v); 
  
    for(j=0;j<2;j++){
      scanf("%d",&c); 
  
      if(j==0){
    T[v].l=c;  
      } else {
    T[v].r=c;
      }
    T[c].y=v;       
    }
  }
  
  for(i=0;i<n;i++){
    if(T[i].y==nil){
      root=i;
      break;
    }
  }
  
  printf("Preorder\n");
  preorder(root);
  printf("\n");
  printf("Inorder\n");
  inorder(root);
  printf("\n");
  printf("Postorder\n");
  postorder(root);
  printf("\n");
   
  return 0;
}
  
  
void preorder(int u){
  
  printf(" %d",u);
  if(T[u].l!=nil) preorder(T[u].l);
  if(T[u].r!=nil) preorder(T[u].r);
  
}
  
void inorder(int u){
  
  if(T[u].l!=nil) inorder(T[u].l);
  printf(" %d",u);
  if(T[u].r!=nil) inorder(T[u].r);
}
  
void postorder(int u){ 
   
  if(T[u].l!=nil) postorder(T[u].l);
  if(T[u].r!=nil) postorder(T[u].r);
  printf(" %d",u);
  

Compiler output:
main.c:17:1: error: return type defaults to 'int' [-Wimplicit-int]
   17 | main(){
      | ^~~~
main.c: In function 'postorder':
main.c:83:3: error: expected declaration or statement at end of input
   83 |   printf(" %d",u);
      |   ^~~~~~
Language: C

#include<stdio.h>
#define MAX 10000
#define NIL -1

struct Node {int p, l ,r;};
struct Node T[MAX];
int n;

void preParse(int u){
  if(u == NIL)return;
  printf(" %d",u);
  preParse(T[u].l);
  preParse(T[u].r);
}

void inParse(int u){
  if( u == NIL )return;
  inParse(T[u].l);
  printf(" %d",u);
  inParse(T[u].r);
}

void postParse(int u){
  if(u ==NIL)return;
  postParse(T[u].l);
  postParse(T[u].r);
  printf(" %d",u);
}

int main(){
  int i,v,l,r,root;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].p = NIL;
  }

  for(i=0; i<n; i++){
    scanf("%d %d %d",&v,&l,&r);
    T[v].l = l;
    T[v].r = r;
    if(l != NIL)T[l].p = v;
    if(l != NIL)T[r].p = v;
  }

  for (I = 0;i<n;i++)if (T[i].p == NIL)root =i

  printf("Preorder\n");
  preParse(root);
  printf("\n");
  printf("Inorder\n");
  inParse(root);
  printf("\n");
  printf("Pstorder\n");
  postParse(root);
  printf("\n");
  

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:46:8: error: 'I' undeclared (first use in this function)
   46 |   for (I = 0;i<n;i++)if (T[i].p == NIL)root =i
      |        ^
main.c:46:8: note: each undeclared identifier is reported only once for each function it appears in
main.c:46:47: error: expected ';' before 'printf'
   46 |   for (I = 0;i<n;i++)if (T[i].p == NIL)root =i
      |                                               ^
      |                                               ;
   47 | 
   48 |   printf("Preorder\n");
      |   ~~~~~~
Language: C

#include <stdio.h>
#define MAX 10000
#define NIL -1

struct Node{ int p,l,r; };
struct Node T[MAX];
int n;

void preParse(int u){
  if(u == NIL) return ;
  printf(" %d", u);
  preParse(T[u].l);
  preParse(T[u].r);
}

void inParse(int u){
  if(u == NIL) return ;
  inParse(T[u].l);
  printf(" %d",u);
  inParse(T[u].r);
}

void postParse(int u){
  if(u == NIL) return ;
  postParse(T[u].l);
  postParse(T[u].r);
  printf(" %d",  u);
}

int main(){
  int i,v,l,r,root;

  scanf("%d",&n);
  for(i = 0;i < n;i++) T[i].p = NIL;
  for(i = 0;i < n;i++){
    scanf("%d %d %d",&v,&l,&r);
    T[v].l = l;
    T[v].r = r;
    if(l != NIL) T[l].p = v;
    if(r != NIL) T[r].p = v;
  }
  for(i = 0;i < n;i++) if(T[i].p == NIL) root = i;
  printf("Preorder\n");
  preParse(root);
  prinf("\n");
  printf("Inorder\n");
  inParse(root);
  printf("\n");
  printf("Postorder\n");
  postParse(root);
  printf("\n");
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:45:3: error: implicit declaration of function 'prinf'; did you mean 'printf'? [-Wimplicit-function-declaration]
   45 |   prinf("\n");
      |   ^~~~~
      |   printf
Language: C

#include<stdio.h>
#define NIL -1
#define N 25
void preorder(int);
void inorder(int);
void postorder(int);

typedef struct{
  int id;
  int left;
  int right;
}Tree;
Tree T[N];

int main(){
  int i,n;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d %d %d",&Ti].id,&T[i].left,&T[i].right);
  }

  printf("Preorder\n");
  preorder(T[0].id);
  printf("\nInorder\n");
  inorder(T[0].id);
  printf("\nPostorder\n");
  postorder(T[0].id);
  printf("\n");
  return 0;
}
void preorder(int u){
  if(u==NIL)
    return;
  printf(" %d",u);
  preorder(T[u].left);
  preorder(T[u].right);
}
void inorder(int u){
  if(u==NIL)
    return;
  inorder(T[u].left);
  printf(" %d",u);
  inorder(T[u].right);
}
void postorder(int u){
  if(u==NIL)
    return;
  postorder(T[u].left);
  postorder(T[u].right);
  printf(" %d",u);
}

Compiler output:
main.c: In function 'main':
main.c:20:23: error: 'Ti' undeclared (first use in this function); did you mean 'i'?
   20 |     scanf("%d %d %d",&Ti].id,&T[i].left,&T[i].right);
      |                       ^~
      |                       i
main.c:20:23: note: each undeclared identifier is reported only once for each function it appears in
main.c:20:25: error: expected ')' before ']' token
   20 |     scanf("%d %d %d",&Ti].id,&T[i].left,&T[i].right);
      |          ~              ^
      |                         )
main.c:20:25: error: expected ';' before ']' token
   20 |     scanf("%d %d %d",&Ti].id,&T[i].left,&T[i].right);
      |                         ^
      |                         ;
main.c:20:25: error: expected statement before ']' token
main.c:20:26: error: expected expression before '.' token
   20 |     scanf("%d %d %d",&Ti].id,&T[i].left,&T[i].right);
      |                          ^
main.c:20:52: error: expected statement before ')' token
   20 |     scanf("%d %d %d",&Ti].id,&T[i].left,&T[i].right);
      |                                                    ^
Language: C

#include <stdio.h>
#define MAX 10000
  
struct node{
  int p, q, r;
};
struct node T[MAX];
int n;
  
void preorder(int t){
  if(t == -1) return;
  printf(" %d",t);
  preorder(T[t].q);
  preorder(T[t].r);
}
  
void inorder(int t){
  if(t == -1) return;
  inorder(T[t].q);
  printf(" %d",t);
  inorder(T[t].r);
}
  
void post(int t){
  if(u == -1) return;
  post(T[t].q);
  post(T[t].r);
  printf(" %d",t);
}
  
int main(){
  int i, v, q, r, root;
  
  scanf("%d", &n);
  for(i = 0; i < n; i++) T[i].p = -1;
  
  for(i = 0; i < n; i++){
    scanf("%d %d %d", &v, &q, &r);
    T[v].q = q;
    T[v].r = r;
    if(q != -1) T[q].p = v;
    if(r != -1) T[r].p = v;
  }
  
  for(i = 0; i < n; i++)
    if(T[i].p == -1) root = i;
  printf("Preorder\n");
  preorder(root);
  printf("\n");
  printf("Inorder\n");
  inorder(root);
  printf("\n");
  printf("Postorder\n");
 post(root);
  printf("\n");
  
  return 0;
}

Compiler output:
main.c: In function 'post':
main.c:25:6: error: 'u' undeclared (first use in this function)
   25 |   if(u == -1) return;
      |      ^
main.c:25:6: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

#define N 25
#define NIL -1

typedef struct{
  int parent;
  int left;
  int right;
}Tree_t;

void preParse(int u){
if (u == NIL) return;
printf(" %f",T[u]);
preParse(T[u].left);
preParse(T[u].right);
}

void inParse(u){
if (u == NIL) return;
inParse(T[u].left);
printf(" %f",T[u]);
inParse(T[u].right);
}

void postParse(u){
if (u == NIL) return;
postParse(T[u].left);
postParse(T[u].right);
printf(" %f",T[u]);
}

Tree_t T[N];
int n;

int main(){
  int id,left,right;

  scanf("%d",&n);

for(i=0;i<n;i++){
  scanf("%d%d%d",&id,&left,&right);
  T[id].left=left;
  T[id].right=right;
  if(left!=NIL) T[left].parent=;
  if(right!=NIL) T[right].parent=id;
}

for(i=0;i<n;i++){
if(T[i].parent == NIL) root = i;
}

printf("Preorder\n");
preParse(root);
printf("\n");

printf("Inorder\n");
inParse(root);
printf("\n");

printf("Postorder\n");
postParse(root);
printf("\n");

return 0;
}

Compiler output:
main.c: In function 'preParse':
main.c:14:14: error: 'T' undeclared (first use in this function)
   14 | printf(" %f",T[u]);
      |              ^
main.c:14:14: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'inParse':
main.c:19:6: error: type of 'u' defaults to 'int' [-Wimplicit-int]
   19 | void inParse(u){
      |      ^~~~~~~
main.c:21:9: error: 'T' undeclared (first use in this function)
   21 | inParse(T[u].left);
      |         ^
main.c: In function 'postParse':
main.c:26:6: error: type of 'u' defaults to 'int' [-Wimplicit-int]
   26 | void postParse(u){
      |      ^~~~~~~~~
main.c:28:11: error: 'T' undeclared (first use in this function)
   28 | postParse(T[u].left);
      |           ^
main.c: In function 'main':
main.c:41:5: error: 'i' undeclared (first use in this function); did you mean 'id'?
   41 | for(i=0;i<n;i++){
      |     ^
      |     id
main.c:45:32: error: expected expression before ';' token
   45 |   if(left!=NIL) T[left].parent=;
      |                                ^
main.c:50:24: error: 'root' undeclared (first use in this function)
   50 | if(T[i].parent == NIL) root = i;
      |                        ^~~~
Language: C

#include <stdio.h>

#define N 25
#define NIL -1

typedef struct{
  int parent;
  int left;
  int right;
}Tree_t;

Tree_t T[N];
int n;

void preParse(int u){
if (u == NIL) return;
printf(" %f",T[u]);
preParse(T[u].left);
preParse(T[u].right);
}

void inParse(u){
if (u == NIL) return;
inParse(T[u].left);
printf(" %f",T[u]);
inParse(T[u].right);
}

void postParse(u){
if (u == NIL) return;
postParse(T[u].left);
postParse(T[u].right);
printf(" %f",T[u]);
}

int main(){
  int id,left,right;

  scanf("%d",&n);

for(i=0;i<n;i++){
  scanf("%d%d%d",&id,&left,&right);
  T[id].left=left;
  T[id].right=right;
  if(left!=NIL) T[left].parent=;
  if(right!=NIL) T[right].parent=id;
}

for(i=0;i<n;i++){
if(T[i].parent == NIL) root = i;
}

printf("Preorder\n");
preParse(root);
printf("\n");

printf("Inorder\n");
inParse(root);
printf("\n");

printf("Postorder\n");
postParse(root);
printf("\n");

return 0;
}

Compiler output:
main.c: In function 'inParse':
main.c:22:6: error: type of 'u' defaults to 'int' [-Wimplicit-int]
   22 | void inParse(u){
      |      ^~~~~~~
main.c: In function 'postParse':
main.c:29:6: error: type of 'u' defaults to 'int' [-Wimplicit-int]
   29 | void postParse(u){
      |      ^~~~~~~~~
main.c: In function 'main':
main.c:41:5: error: 'i' undeclared (first use in this function); did you mean 'id'?
   41 | for(i=0;i<n;i++){
      |     ^
      |     id
main.c:41:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:45:32: error: expected expression before ';' token
   45 |   if(left!=NIL) T[left].parent=;
      |                                ^
main.c:50:24: error: 'root' undeclared (first use in this function)
   50 | if(T[i].parent == NIL) root = i;
      |                        ^~~~
Language: C

#include <stdio.h>

#define N 25
#define NIL -1

typedef struct{
  int parent;
  int left;
  int right;
}Tree_t;

Tree_t T[N];
int n;

void preParse(int u){
if (u == NIL) return;
printf(" %f",T[u]);
preParse(T[u].left);
preParse(T[u].right);
}

void inParse(u){
if (u == NIL) return;
inParse(T[u].left);
printf(" %f",T[u]);
inParse(T[u].right);
}

void postParse(u){
if (u == NIL) return;
postParse(T[u].left);
postParse(T[u].right);
printf(" %f",T[u]);
}

int main(){
  int id,left,right,i,root;

  scanf("%d",&n);

for(i=0;i<n;i++){
  scanf("%d%d%d",&id,&left,&right);
  T[id].left=left;
  T[id].right=right;
  if(left!=NIL) T[left].parent=;
  if(right!=NIL) T[right].parent=id;
}

for(i=0;i<n;i++){
if(T[i].parent == NIL) root = i;
}

printf("Preorder\n");
preParse(root);
printf("\n");

printf("Inorder\n");
inParse(root);
printf("\n");

printf("Postorder\n");
postParse(root);
printf("\n");

return 0;
}

Compiler output:
main.c: In function 'inParse':
main.c:22:6: error: type of 'u' defaults to 'int' [-Wimplicit-int]
   22 | void inParse(u){
      |      ^~~~~~~
main.c: In function 'postParse':
main.c:29:6: error: type of 'u' defaults to 'int' [-Wimplicit-int]
   29 | void postParse(u){
      |      ^~~~~~~~~
main.c: In function 'main':
main.c:45:32: error: expected expression before ';' token
   45 |   if(left!=NIL) T[left].parent=;
      |                                ^
Language: C

#include<stdio.h>
#define MAX 10000
#define NOT -1
struct Node {int parent,left,right;};
struct Node T[MAX];
int n;
//???????????????
void preParse(int u){
  if(u==NOT)return;
  printf(" %d",u);
  preParse(T[u].left);
  preParse(T[u].right);

}
//??????
void inParse(int u){
  if(u==NOT)return;
 
  inParse(T[u].left);
  printf(" %d",u);
  inParse(T[u].right);

}
//??????
void postParse(int u){
  if(u==NOT)return;
  postParse(T[u].left);
  postParse(T[u].right);
  printf(" %d",u);
}



int main(){
  int i,id,left,right,root;
  scanf("%d",&n);
  for(i=0;i<n;i++)T[i].parent=NOT;

  for(i=0;i<n;i++){
    scanf("%d %d %d",&id,&left,&right);
    T[id].left=left;
    T[id].right=right;
    if(left!=NOT)T[left].parent=id;
    if(right!=NOT)T[right].parent=id;
    
  }

  for(i=0;i<n;i++)if(T[i].parent ==NOT)root=i;

  printf("Preoder\n");
  preParse(root);
  printf("\n");
  prinf("Inorder\n");
  inParse(root);
  printf("\n");
  printf("Postorder\n");
  postParse(root);
  printf("\n");
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:53:3: error: implicit declaration of function 'prinf'; did you mean 'printf'? [-Wimplicit-function-declaration]
   53 |   prinf("Inorder\n");
      |   ^~~~~
      |   printf
Language: C

#include <stdio.h>
#define MAX 100
 
void Preorder(int);
void Inorder(int);
void Postorder(int);
 
struct Node{
  int parent, left, right;
};
  
struct Node T[MAX];
int n;
 
void Preorder(int i){
  printf(" %d",i);
  if ( T[i].left != -1 ) Preorder( T[i].left );
  if ( T[i].right != -1 ) Preorder( T[i].right );
}
 
void Inorder(int i){
  if( T[i].left != -1 ) Inorder( T[i].left );
  printf(" %d",i);
  if( T[i].right != -1 ) Inorder( T[i].right);
}
   
void Postorder(int i){ 
  if( T[i].left != -1 ) Postorder( T[i].left );
  if( T[i].right != -1 ) Postorder( T[i].right );
  printf(" %d",i);
   
}
 
int main(){
  int root = 0,i,j,a;
  scanf("%d",&n);
  
  for( i = 0 ; i < n ; i++ ){
    T[i].parent = -1;
    T[i].left = -1;
    T[i].right = -1;
  }
 
  for( i = 0; i < n ; i++ ){
    scanf("%d", &a);
    scanf("%d %d", &T[a].left, &T[a].right);
    if(T[a].left != -1) Tree[T[a].left].parent = a;
    if(T[a].right != -1) Tree[T[a].right].parent = a;
  }
 
  for( i = 0 ; i < n ; i++ ){
    if( T[i].parent == -1 ) root = i;
  }
 
  printf("Preorder\n");
  Preorder(root);
 
  printf("\nInorder\n");
  Inorder(root);
 
  printf("\nPostorder\n");
  Postorder(root);
  printf("\n");
 
  return 0;
}
 

Compiler output:
main.c: In function 'main':
main.c:47:25: error: 'Tree' undeclared (first use in this function)
   47 |     if(T[a].left != -1) Tree[T[a].left].parent = a;
      |                         ^~~~
main.c:47:25: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#define N -1

typedef struct{
    int id;
    int p;
    int l;
    int r;
}Tree;
 
Tree T[25];
 
void pre(int i){
    printf(" %d",i);
    if(T[i].l != N){
        pre(T[i].l);
    }
    if(T[i].r != N){
        preo(T[i].r);
    }
}
 
void in(int i){
    if(T[i].l != N){
        in(T[i].l);
    }
    printf(" %d",i);

    if(T[i].r != N){
        in(T[i].r);
    }
}
 
void post(int i){
    if(T[i].l != N){
        post(T[i].l);
    }

    if(T[i].r != N){
        post(T[i].r);
    }
    printf(" %d",i);
     
}
int main(){
    int i,j,n;
    int id;
    int data;
    scanf("%d",&n);

    for(i=0; i < n; i++){
        T[i].p = N;
    }
     
    for(i=0;i<n;i++){
        scanf("%d",&id);
        T[id].id = id;

        scanf("%d",&data);
        T[id].l = data;
        if(data != N){
            T[data].p = id;
        } 
        scanf("%d",&data);
        T[id].r = data;
        if(data != N){
            T[data].p=id;
        }
    }
    
    i=0;
    while(T[i].p != N){
        i++;
    }
    id=i;
     
    printf("Preorder\n");
    pre(id);
     
    printf("\nInorder\n");
    in(id);
     
    printf("\nPostorder\n");
    post(id);

    printf("\n");
     
    return 0;
     
}
 

Compiler output:
main.c: In function 'pre':
main.c:19:9: error: implicit declaration of function 'preo'; did you mean 'pre'? [-Wimplicit-function-declaration]
   19 |         preo(T[i].r);
      |         ^~~~
      |         pre
Language: C

#include<stdio.h>
#define MAX 10000
#define NIL -1
??
struct Node{
????int p, l, r;
};
struct Node T[MAX];
int n;
??
void preParse(int u){
????if(u == NIL) return;
????printf(" %d",u);
????preParse(T[u].l);
????preParse(T[u].r);
}
??
void inParse(int u){
????if(u == NIL) return;
????inParse(T[u].l);
????printf(" %d",u);
????inParse(T[u].r);
}
??
void postParse(int u){
????if(u == NIL) return;
????postParse(T[u].l);
????postParse(T[u].r);
????printf(" %d",u);
}
??
int main(){
????int i, v, l, r, root;
??
????scanf("%d", &n);
????for(i = 0; i < n; i++){
????????T[i].p = NIL;
????}
??
????for(i = 0; i < n; i++){
????????scanf("%d %d %d", &v, &l, &r);
????????T[v].l = l;
????????T[v].r = r;
????????if(l != NIL) T[l].p = v;
????????if(r != NIL) T[r].p = v;
????}
??
????for(i = 0; i < n; i++) if(T[i].p == NIL) root = i;
??
????printf("Preorder\n");
????preParse(root);
????printf("\n");
????printf("Inorder\n");
????inParse(root);
????printf("\n");
????printf("Postorder\n");
????postParse(root);
????printf("\n");
??
????return 0;
}

Compiler output:
main.c:4:1: error: expected identifier or '(' before '?' token
    4 | ??
      | ^
main.c:8:13: error: array type has incomplete element type 'struct Node'
    8 | struct Node T[MAX];
      |             ^
main.c:10:1: error: expected identifier or '(' before '?' token
   10 | ??
      | ^
main.c:17:1: error: expected identifier or '(' before '?' token
   17 | ??
      | ^
main.c:24:1: error: expected identifier or '(' before '?' token
   24 | ??
      | ^
main.c:31:1: error: expected identifier or '(' before '?' token
   31 | ??
      | ^
Language: C

#include<stdio.h>
#define MAX 10000
#define NIL -1
struct Node{
int p, l, r;
};
struct Node T[MAX];
int n;??
void preParse(int u){
if(u == NIL) return;
printf(" %d",u);
preParse(T[u].l);
preParse(T[u].r);
}
void inParse(int u){
if(u == NIL) return;
inParse(T[u].l);
printf(" %d",u);
inParse(T[u].r);
}??
void postParse(int u){
if(u == NIL) return;
postParse(T[u].l);
postParse(T[u].r);
printf(" %d",u);
}??
int main(){
int i, v, l, r, root;??
scanf("%d", &n);
for(i = 0; i < n; i++){
T[i].p = NIL;
}??
for(i = 0; i < n; i++){
scanf("%d %d %d", &v, &l, &r);
T[v].l = l;
T[v].r = r;
if(l != NIL) T[l].p = v;
if(r != NIL) T[r].p = v;
}
for(i = 0; i < n; i++) if(T[i].p == NIL) root = i;??
printf("Preorder\n");
preParse(root);
printf("\n");
printf("Inorder\n");
inParse(root);
printf("\n");
printf("Postorder\n");
postParse(root);
printf("\n");
return 0;
}

Compiler output:
main.c:8:7: error: expected identifier or '(' before '?' token
    8 | int n;??
      |       ^
main.c:20:2: error: expected identifier or '(' before '?' token
   20 | }??
      |  ^
main.c:26:2: error: expected identifier or '(' before '?' token
   26 | }??
      |  ^
Language: C

#include<stdio.h>
#define MAX 10000
#define NIL -1
struct Node{
int p, l, r;
};
struct Node T[MAX];
int n;
void preParse(int u){
if(u == NIL) return;
printf(" %d",u);
preParse(T[u].l);
preParse(T[u].r);
}
void inParse(int u){
if(u == NIL) return;
inParse(T[u].l);
printf(" %d",u);
inParse(T[u].r);
}??
void postParse(int u){
if(u == NIL) return;
postParse(T[u].l);
postParse(T[u].r);
printf(" %d",u);
}??
int main(){
int i, v, l, r, root;
scanf("%d", &n);
for(i = 0; i < n; i++){
T[i].p = NIL;
}??
for(i = 0; i < n; i++){
scanf("%d %d %d", &v, &l, &r);
T[v].l = l;
T[v].r = r;
if(l != NIL) T[l].p = v;
if(r != NIL) T[r].p = v;
}
for(i = 0; i < n; i++) if(T[i].p == NIL) root = i;
printf("Preorder\n");
preParse(root);
printf("\n");
printf("Inorder\n");
inParse(root);
printf("\n");
printf("Postorder\n");
postParse(root);
printf("\n");
return 0;
}

Compiler output:
main.c:20:2: error: expected identifier or '(' before '?' token
   20 | }??
      |  ^
main.c:26:2: error: expected identifier or '(' before '?' token
   26 | }??
      |  ^
Language: C

#include<stdio.h>
#define max 10000
#define NIL -1

struct Node{
  int p;
  int l;
  int r;
};

struct Node T[max];
int n;

void inParse(int u){
  if(u == NIL) return;
  inParse(T[u].l);
  printf(" %d", u);
  inParse(T[u].r);
 }
}

void postParse(int u){
  if(u == -1) return;
  postParse(T[u].l);
  postParse(T[u].r);
  printf(" %d",u);
}

int main(){
  int i,v,r,root;

  scanf("%d",&n);
  for(i=0 ; i<n ; i++) T[i].p = NIL;

  for(i=0 ; i<n ; i++){
    scanf("%d %d %d",&v,&l,&r);
    T[v].l = l;
    T[v].r = r;
    if(l != NIL) T[l].p = v;
    if(r != NIL) T[r].p = v;
  }
  for(i=0 ; i<n ; i++) if(T[i].p == NIL) root = i;

  printf("Preorder\n");
  preParse(root);
  printf("\n");
  printf("Inorder\n");
  inParse(root);
  printf("\n");
  printf("Postorder\n");
  postParse(root);
  printf("\n");

  return 0;
}

Compiler output:
main.c:20:1: error: expected identifier or '(' before '}' token
   20 | }
      | ^
main.c: In function 'main':
main.c:36:26: error: 'l' undeclared (first use in this function)
   36 |     scanf("%d %d %d",&v,&l,&r);
      |                          ^
main.c:36:26: note: each undeclared identifier is reported only once for each function it appears in
main.c:45:3: error: implicit declaration of function 'preParse'; did you mean 'postParse'? [-Wimplicit-function-declaration]
   45 |   preParse(root);
      |   ^~~~~~~~
      |   postParse
Language: C

#include<stdio.h>
#define max 10000
#define NIL -1

struct Node{
  int p;
  int l;
  int r;
};

struct Node T[max];
int n;

void preParse(int u){
  if(u == NIL) return;
  printf(" %d"u);
  preParse(T[u].l);
  preParse(T[u].r);
}

void inParse(int u){
  if(u == NIL) return;
  inParse(T[u].l);
  printf(" %d", u);
  inParse(T[u].r);
}


void postParse(int u){
  if(u == -1) return;
  postParse(T[u].l);
  postParse(T[u].r);
  printf(" %d",u);
}

int main(){
  int i,v,r,l,root;

  scanf("%d",&n);
  for(i=0 ; i<n ; i++) T[i].p = NIL;

  for(i=0 ; i<n ; i++){
    scanf("%d %d %d",&v,&l,&r);
    T[v].l = l;
    T[v].r = r;
    if(l != NIL) T[l].p = v;
    if(r != NIL) T[r].p = v;
  }
  for(i=0 ; i<n ; i++) if(T[i].p == NIL) root = i;

  printf("Preorder\n");
  preParse(root);
  printf("\n");
  printf("Inorder\n");
  inParse(root);
  printf("\n");
  printf("Postorder\n");
  postParse(root);
  printf("\n");

  return 0;
}

Compiler output:
main.c: In function 'preParse':
main.c:16:15: error: expected ')' before 'u'
   16 |   printf(" %d"u);
      |         ~     ^
      |               )
Language: C

#include<stdio.h>
#define N 26

void pre(int);
void ino(int);
void pos(int);

struct Node{
 int v, a, b; 
};

struct Node G[N];

int n, i, l, r, p;

char S[4][100]={"Preorder","Inorder","Postorder"};

int main(){
????????void (*funcs[])(int)={pre,ino,pos};
????????scanf("%d",&n);
????????for(i=0;i<n;i++)
????????{
????????????????scanf("%d%d%d",&p,&l,&r);
????????????????G[l].v=G[r].v=1;
????????????????G[p].a=l;
????????????????G[p].b=r;
????????}
????????for(i=0;i<n;i++)if(!G[i].v)p=i;
????????for(i=0;i<3;i++)
????????{
????????????????puts(S[i]);
????????????????(*(funcs[i]))(p);
????????????????puts("");
????????}
????????return 0;
}

void pre(int n)
{
????????if(n==-1)return;
????????printf(" %d",n);
????????pre(G[n].a);
????????pre(G[n].b);
????????return;
}

void ino(int n)
{
????????if(n==-1)return;
????????ino(G[n].a);
????????printf(" %d",n);
????????ino(G[n].b);
????????return;
}

void pos(int n)
{
????????if(n==-1)return;
????????pos(G[n].a);
????????pos(G[n].b);
????????printf(" %d",n);
????????return;
}

Compiler output:
main.c: In function 'main':
main.c:19:1: error: expected expression before '?' token
   19 | ????????void (*funcs[])(int)={pre,ino,pos};
      | ^
main.c:20:1: error: expected expression before '?' token
   20 | ????????scanf("%d",&n);
      | ^
main.c:21:1: error: expected expression before '?' token
   21 | ????????for(i=0;i<n;i++)
      | ^
main.c:29:1: error: expected expression before '?' token
   29 | ????????for(i=0;i<3;i++)
      | ^
main.c:32:15: warning: trigraph ??( ignored, use -trigraphs to enable [-Wtrigraphs]
   32 | ????????????????(*(funcs[i]))(p);
main.c: In function 'pre':
main.c:40:1: error: expected expression before '?' token
   40 | ????????if(n==-1)return;
      | ^
main.c:41:1: error: expected expression before '?' token
   41 | ????????printf(" %d",n);
      | ^
main.c:42:1: error: expected expression before '?' token
   42 | ????????pre(G[n].a);
      | ^
main.c:43:1: error: expected expression before '?' token
   43 | ????????pre(G[n].b);
      | ^
main.c:44:1: error: expected expression before '?' token
   44 | ????????return;
      | ^
main.c: In function 'ino':
main.c:49:1: error: expected expression before '?' token
   49 | ????????if(n==-1)return;
      | ^
main.c:50:1: error: expected expression before '?' token
   50 | ????????ino(G[n].a);
      | ^
main.c:51:1: error: expected expression before '?' token
   51 | ????????printf(" %d",n);
      | ^
main.c:52:1: error: expected expression before '?' token
   52 | ????????ino(G[n].b);
      | ^
main.c:53:1: error: expected expression before '?' token
   53 | ????????return;
      | ^
main.c: In function 'pos':
main.c:58:1: error: expected expression before '?' token
   58 | ????????if(n==-1)return;
      | ^
main.c:59:1: error: expected expression before '?' token
   59 | ????????pos(G[n].a);
      | ^
main.c:60:1: error: expected expression before '?' token
   60 | ????????pos(G[n].b);
      | ^
main.c:61:1: error: expected expression before '?' token
   61 | ????????printf(" %d",n);
      | ^
main.c:62:1: error: expected expression before '?' token
   62 | ????????return;
      | ^
Language: C

#include<stdio.h>
#define N 26

void pre(int);
void ino(int);
void pos(int);

struct Node{
 int v, a, b; 
};

struct Node G[N];

int n, i, l, r, p;

char S[4][100]={"Preorder","Inorder","Postorder"};

int main(){
    void (*funcs[])(int)={pre,ino,pos};
????????scanf("%d",&n);
????????for(i=0;i<n;i++)
????????{
????????????????scanf("%d%d%d",&p,&l,&r);
????????????????G[l].v=G[r].v=1;
????????????????G[p].a=l;
????????????????G[p].b=r;
????????}
????????for(i=0;i<n;i++)if(!G[i].v)p=i;
????????for(i=0;i<3;i++)
????????{
????????????????puts(S[i]);
????????????????(*(funcs[i]))(p);
????????????????puts("");
????????}
????????return 0;
}

void pre(int n)
{
????????if(n==-1)return;
????????printf(" %d",n);
????????pre(G[n].a);
????????pre(G[n].b);
????????return;
}

void ino(int n)
{
????????if(n==-1)return;
????????ino(G[n].a);
????????printf(" %d",n);
????????ino(G[n].b);
????????return;
}

void pos(int n)
{
????????if(n==-1)return;
????????pos(G[n].a);
????????pos(G[n].b);
????????printf(" %d",n);
????????return;
}

Compiler output:
main.c: In function 'main':
main.c:20:1: error: expected expression before '?' token
   20 | ????????scanf("%d",&n);
      | ^
main.c:21:1: error: expected expression before '?' token
   21 | ????????for(i=0;i<n;i++)
      | ^
main.c:29:1: error: expected expression before '?' token
   29 | ????????for(i=0;i<3;i++)
      | ^
main.c:32:15: warning: trigraph ??( ignored, use -trigraphs to enable [-Wtrigraphs]
   32 | ????????????????(*(funcs[i]))(p);
main.c: In function 'pre':
main.c:40:1: error: expected expression before '?' token
   40 | ????????if(n==-1)return;
      | ^
main.c:41:1: error: expected expression before '?' token
   41 | ????????printf(" %d",n);
      | ^
main.c:42:1: error: expected expression before '?' token
   42 | ????????pre(G[n].a);
      | ^
main.c:43:1: error: expected expression before '?' token
   43 | ????????pre(G[n].b);
      | ^
main.c:44:1: error: expected expression before '?' token
   44 | ????????return;
      | ^
main.c: In function 'ino':
main.c:49:1: error: expected expression before '?' token
   49 | ????????if(n==-1)return;
      | ^
main.c:50:1: error: expected expression before '?' token
   50 | ????????ino(G[n].a);
      | ^
main.c:51:1: error: expected expression before '?' token
   51 | ????????printf(" %d",n);
      | ^
main.c:52:1: error: expected expression before '?' token
   52 | ????????ino(G[n].b);
      | ^
main.c:53:1: error: expected expression before '?' token
   53 | ????????return;
      | ^
main.c: In function 'pos':
main.c:58:1: error: expected expression before '?' token
   58 | ????????if(n==-1)return;
      | ^
main.c:59:1: error: expected expression before '?' token
   59 | ????????pos(G[n].a);
      | ^
main.c:60:1: error: expected expression before '?' token
   60 | ????????pos(G[n].b);
      | ^
main.c:61:1: error: expected expression before '?' token
   61 | ????????printf(" %d",n);
      | ^
main.c:62:1: error: expected expression before '?' token
   62 | ????????return;
      | ^
Language: C

#include<stdio.h>
#define N 26

void pre(int);
void ino(int);
void pos(int);

struct Node{
 int v, a, b; 
};

struct Node G[N];

int n, i, l, r, p;

char S[4][100]={"Preorder","Inorder","Postorder"};

int main(){
    void (*funcs[])(int)={pre,ino,pos};
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d%d%d",&p,&l,&r);
        G[l].v=G[r].v=1;
        G[p].a=l;
        G[p].b=r;
    }
????????for(i=0;i<n;i++)if(!G[i].v)p=i;
????????for(i=0;i<3;i++)
????????{
????????????????puts(S[i]);
????????????????(*(funcs[i]))(p);
????????????????puts("");
????????}
????????return 0;
}

void pre(int n)
{
????????if(n==-1)return;
????????printf(" %d",n);
????????pre(G[n].a);
????????pre(G[n].b);
????????return;
}

void ino(int n)
{
????????if(n==-1)return;
????????ino(G[n].a);
????????printf(" %d",n);
????????ino(G[n].b);
????????return;
}

void pos(int n)
{
????????if(n==-1)return;
????????pos(G[n].a);
????????pos(G[n].b);
????????printf(" %d",n);
????????return;
}

Compiler output:
main.c: In function 'main':
main.c:27:1: error: expected expression before '?' token
   27 | ????????for(i=0;i<n;i++)if(!G[i].v)p=i;
      | ^
main.c:28:1: error: expected expression before '?' token
   28 | ????????for(i=0;i<3;i++)
      | ^
main.c:31:15: warning: trigraph ??( ignored, use -trigraphs to enable [-Wtrigraphs]
   31 | ????????????????(*(funcs[i]))(p);
main.c: In function 'pre':
main.c:39:1: error: expected expression before '?' token
   39 | ????????if(n==-1)return;
      | ^
main.c:40:1: error: expected expression before '?' token
   40 | ????????printf(" %d",n);
      | ^
main.c:41:1: error: expected expression before '?' token
   41 | ????????pre(G[n].a);
      | ^
main.c:42:1: error: expected expression before '?' token
   42 | ????????pre(G[n].b);
      | ^
main.c:43:1: error: expected expression before '?' token
   43 | ????????return;
      | ^
main.c: In function 'ino':
main.c:48:1: error: expected expression before '?' token
   48 | ????????if(n==-1)return;
      | ^
main.c:49:1: error: expected expression before '?' token
   49 | ????????ino(G[n].a);
      | ^
main.c:50:1: error: expected expression before '?' token
   50 | ????????printf(" %d",n);
      | ^
main.c:51:1: error: expected expression before '?' token
   51 | ????????ino(G[n].b);
      | ^
main.c:52:1: error: expected expression before '?' token
   52 | ????????return;
      | ^
main.c: In function 'pos':
main.c:57:1: error: expected expression before '?' token
   57 | ????????if(n==-1)return;
      | ^
main.c:58:1: error: expected expression before '?' token
   58 | ????????pos(G[n].a);
      | ^
main.c:59:1: error: expected expression before '?' token
   59 | ????????pos(G[n].b);
      | ^
main.c:60:1: error: expected expression before '?' token
   60 | ????????printf(" %d",n);
      | ^
main.c:61:1: error: expected expression before '?' token
   61 | ????????return;
      | ^
Language: C

#include<stdio.h>
#define N 26

void pre(int);
void ino(int);
void pos(int);

struct Node{
 int v, a, b; 
};

struct Node G[N];

int n, i, l, r, p;

char S[4][100]={"Preorder","Inorder","Postorder"};

int main(){
    void (*funcs[])(int)={pre,ino,pos};
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d%d%d",&p,&l,&r);
        G[l].v=G[r].v=1;
        G[p].a=l;
        G[p].b=r;
    }
    for(i=0;i<n;i++)if(!G[i].v)p=i;
    for(i=0;i<3;i++){
        puts(S[i]);
        (*(funcs[i]))(p);
        puts("");
    }
    return 0;
}

void pre(int n)
{
????????if(n==-1)return;
????????printf(" %d",n);
????????pre(G[n].a);
????????pre(G[n].b);
????????return;
}

void ino(int n)
{
????????if(n==-1)return;
????????ino(G[n].a);
????????printf(" %d",n);
????????ino(G[n].b);
????????return;
}

void pos(int n)
{
????????if(n==-1)return;
????????pos(G[n].a);
????????pos(G[n].b);
????????printf(" %d",n);
????????return;
}

Compiler output:
main.c: In function 'pre':
main.c:38:1: error: expected expression before '?' token
   38 | ????????if(n==-1)return;
      | ^
main.c:39:1: error: expected expression before '?' token
   39 | ????????printf(" %d",n);
      | ^
main.c:40:1: error: expected expression before '?' token
   40 | ????????pre(G[n].a);
      | ^
main.c:41:1: error: expected expression before '?' token
   41 | ????????pre(G[n].b);
      | ^
main.c:42:1: error: expected expression before '?' token
   42 | ????????return;
      | ^
main.c: In function 'ino':
main.c:47:1: error: expected expression before '?' token
   47 | ????????if(n==-1)return;
      | ^
main.c:48:1: error: expected expression before '?' token
   48 | ????????ino(G[n].a);
      | ^
main.c:49:1: error: expected expression before '?' token
   49 | ????????printf(" %d",n);
      | ^
main.c:50:1: error: expected expression before '?' token
   50 | ????????ino(G[n].b);
      | ^
main.c:51:1: error: expected expression before '?' token
   51 | ????????return;
      | ^
main.c: In function 'pos':
main.c:56:1: error: expected expression before '?' token
   56 | ????????if(n==-1)return;
      | ^
main.c:57:1: error: expected expression before '?' token
   57 | ????????pos(G[n].a);
      | ^
main.c:58:1: error: expected expression before '?' token
   58 | ????????pos(G[n].b);
      | ^
main.c:59:1: error: expected expression before '?' token
   59 | ????????printf(" %d",n);
      | ^
main.c:60:1: error: expected expression before '?' token
   60 | ????????return;
      | ^
Language: C

#include<stdio.h>


struct Node {int p, l,r;};
struct Node T[MAX];
int n;

void preparse(int n) {
  if (n == -1) return;
  printf(" %d"n);
  preparse(T[n].l);
  preparse(T[n].r);
}

void inparse(int n) {
  if(n == -1 ) return;
  inparse(T[n].l);
  printf(" %d",n);
  inparse(T[n].r);
}

void postparse(int n) {
  if(n == -1) return;
  postparse(T[n].l);
  postparse(T[n].r);
  printf(" %d",n);
}

int main() {
  int i,v,l,r,root;
  scanf("%d", &n);
  for (i = 0;i < n; i++) {
    T[i].p =-1;
  }

  for (i = 0;i<n;i++) {
    scanf("%d %d %d",&v,&l,&r);
    T[v].l=l;
    T[v].r=r;
    if(l != -1) T[l].p = v;
    if(r != -1) T[r].p = v;
  }

  for (i = 0;i <n;i++) if (T[i].p == -1) root = i;

  printf("Preorder\n");
  preparse(root);
  printf("\n");
  printf("Inorder\n");
  inparse(root);
  printf("\n");
  printf("Postorder\n");
  postparse(root);
  printf("\n");

  return 0

}

Compiler output:
main.c:5:15: error: 'MAX' undeclared here (not in a function)
    5 | struct Node T[MAX];
      |               ^~~
main.c: In function 'preparse':
main.c:10:15: error: expected ')' before 'n'
   10 |   printf(" %d"n);
      |         ~     ^
      |               )
main.c: In function 'main':
main.c:56:11: error: expected ';' before '}' token
   56 |   return 0
      |           ^
      |           ;
   57 | 
   58 | }
      | ~
Language: C

#include<stdio.h>
#define MAX 10000

struct Node {int p, l,r;};
struct Node T[MAX];
int n;

void preparse(int n) {
  if (n == -1) return;
  printf(" %d"n);
  preparse(T[n].l);
  preparse(T[n].r);
}

void inparse(int n) {
  if(n == -1 ) return;
  inparse(T[n].l);
  printf(" %d",n);
  inparse(T[n].r);
}

void postparse(int n) {
  if(n == -1) return;
  postparse(T[n].l);
  postparse(T[n].r);
  printf(" %d",n);
}

int main() {
  int i,v,l,r,root;
  scanf("%d", &n);
  for (i = 0;i < n; i++) {
    T[i].p =-1;
  }

  for (i = 0;i<n;i++) {
    scanf("%d %d %d",&v,&l,&r);
    T[v].l=l;
    T[v].r=r;
    if(l != -1) T[l].p = v;
    if(r != -1) T[r].p = v;
  }

  for (i = 0;i <n;i++) if (T[i].p == -1) root = i;

  printf("Preorder\n");
  preparse(root);
  printf("\n");
  printf("Inorder\n");
  inparse(root);
  printf("\n");
  printf("Postorder\n");
  postparse(root);
  printf("\n");

  return 0

}

Compiler output:
main.c: In function 'preparse':
main.c:10:15: error: expected ')' before 'n'
   10 |   printf(" %d"n);
      |         ~     ^
      |               )
main.c: In function 'main':
main.c:56:11: error: expected ';' before '}' token
   56 |   return 0
      |           ^
      |           ;
   57 | 
   58 | }
      | ~
Language: C

#include<stdio.h>

struct tree{
 int back, left, right;
};

struct tree a[25];

void preorder(int id){
 if (id == -1){
 return;  
 }
 printf(" %d", id);
 preorder(a[id].left);
 preorder(a[id].right);
}

void inorder(int id){
 if (id == -1){
 return;  
 }
 inorder(a[id].left);
 printf(" %d", id);
 inorder(a[id].right);
}

void postorder(int id){
 if (id == -1){
 return;  
 }
 postorder(a[id].left);
 postorder(a[id].right);
 printf(" %d", id);
}

int main(){
 int num, i, Start, point, left, right;
 
 scanf("%d", &num);
 for(i = 0; i < num; i++){
   a[i].back = -1;
 }

 for(i = 0; i < num; i++){
   scanf("%d %d %d", &point ,&left, &right);
   a[point].left  = left;
   a[point].right = right;
   if(left != -1){
     a[left].back  = point;
     a[right].back = point;
   }
 }
 
 for(i = 0; i < num; i++){
    /* check
    printf("%d %d %d %d\n",i, a[i].back,a[i].left,a[i].right);
    */
   if(a[i].back == -1){
     Start = i;
   }
 }

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

#include<stdio.h>
#define MAX 10000
#define NIL -1

struct Node{
int p,l,r;
};
struct Node T[MAX];
int n;

void preParse(int s){
if(u==NIL)
return;
printf(" %d",s);
preParse(T[s].l);
preParse(T[s].r);
}

void inParse(int s){
if(s==NIL)
return;
inParse(T[s].l);
printf(" %d",s);
inParse(T[s].r);
}

void postParse(int s){
if(s==NIL)
return;
postParse(T[s].l);
postParse(T[s].r);
printf(" %d",s);
}


int main(){
int i,v,l,r,root;
scanf("%d",&n);
for(i=0;i<n;i++){
T[i].p=NIL;
}

for(i=0;i<n;i++){
scanf("%d %d %d",&v,&l,&r);
T[v].l=l;
T[v].r=r;
if(l!=NIL) T[l].p = v;
if(r!=NIL) T[r].p = v;
}

for(i=0;i<n;i++)
if(T[i].p==NIL) 
root = i;
printf("Preorder\n");
preParse(root);
printf("\n");
printf("Inorder\n");
inParse(root);
printf("\n");
printf("Postorder\n");
postParse(root);
printf("\n");
return 0;

Compiler output:
main.c: In function 'preParse':
main.c:12:4: error: 'u' undeclared (first use in this function)
   12 | if(u==NIL)
      |    ^
main.c:12:4: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:63:1: error: expected declaration or statement at end of input
   63 | return 0;
      | ^~~~~~
Language: C

#include <stdio.h>
#define MAX 10000
#define NIL -1

struct Node { int p, l, r;};
struct Node T[MAX];
int n;

void preParse(int u) {
  if(u == NIL)
    return;
  printf(" %d", u);
  preParse(T[u].l);
  preParse(T[u].r);
}

void inParse(int u) {
  if(u == NIL)
    return;
  inParse(T[u].l);
  printf(" %d", u);
  inparse(T[u].r);
}

void postParse(int u) {
  if(u == NIL)
    return;
  postParse(T[u].l);
  postParse(T[u].r);
  printf(" %d", u);
}

int main(void)
{
  int i, v, l, r, root;

  scanf("%d", &n);
  for(i = 0; i < n; i++) {
    T[i].p = NIL;
  }

  for(i = 0; i < n; i++) {
    scanf("%d %d %d", &v, &l, &r);
    T[v].l = l;
    T[v].r = r;
    if(l != NIL)
      T[l].p = v;
    if(r != NIL)
      T[r].p = v;
  }

  for(i = 0; i < n; i++)
    if(T[i].p == NIL)
      root = i;

  printf("Preorder\n");
  preParse(root);
  printf("\n");
  printf("Inorder\n");
  inParse(root);
  printf("\n");
  printf("Postorder\n");
  postParse(root);
  printf("\n");

  return 0;
}

Compiler output:
main.c: In function 'inParse':
main.c:22:3: error: implicit declaration of function 'inparse'; did you mean 'inParse'? [-Wimplicit-function-declaration]
   22 |   inparse(T[u].r);
      |   ^~~~~~~
      |   inParse
Language: C

#include<stdio.h>
#define MAX 10000
#define NIL -1

struct Node{
int p,l,r;
};
struct Node T[MAX];
int n;

void preParse(int s){
if(u==NIL)
return;
printf(" %d",s);
preParse(T[s].l);
preParse(T[s].r);
}

void inParse(int s){
if(s==NIL)
return;
inParse(T[s].l);
printf(" %d",s);
inParse(T[s].r);
}

void postParse(int s){
if(s==NIL)
return;
postParse(T[s].l);
postParse(T[s].r);
printf(" %d",s);
}


int main(){
int i,v,l,r,root;
scanf("%d",&n);
for(i=0;i<n;i++){
T[i].p=NIL;
}

for(i=0;i<n;i++){
scanf("%d %d %d",&v,&l,&r);
T[v].l=l;
T[v].r=r;
if(l!=NIL) T[l].p = v;
if(r!=NIL) T[r].p = v;
}

for(i=0;i<n;i++)
if(T[i].p==NIL) 
root = i;
printf("Preorder\n");
preParse(root);
printf("\n");
printf("Inorder\n");
inParse(root);
printf("\n");
printf("Postorder\n");
postParse(root);
printf("\n");
return 0;
}

Compiler output:
main.c: In function 'preParse':
main.c:12:4: error: 'u' undeclared (first use in this function)
   12 | if(u==NIL)
      |    ^
main.c:12:4: note: each undeclared identifier is reported only once for each function it appears in