Language: C

#include <stdio.h>
  

  
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=-1;
    T[i].l=-1
    T[i].r=-1
  }
  
  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==-1
      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!=-1preorder(T[u].l);
  if(T[u].r!=-1preorder(T[u].r);
  
}
  
void inorder(int u){
  
  if(T[u].l!=-1inorder(T[u].l);
  printf(" %d",u);
  if(T[u].r!=-1inorder(T[u].r);
}
  
void postorder(int u){ 
   
  if(T[u].l!=-1postorder(T[u].l);
  if(T[u].r!=-1postorder(T[u].r);
  printf(" %d",u);
  
}

Compiler output:
main.c:18:1: error: return type defaults to 'int' [-Wimplicit-int]
   18 | main(){
      | ^~~~
main.c: In function 'main':
main.c:25:14: error: expected ';' before 'T'
   25 |     T[i].l=-1
      |              ^
      |              ;
   26 |     T[i].r=-1
      |     ~         
main.c:45:18: error: expected ')' before 'root'
   45 |     if(T[i].y==-1
      |       ~          ^
      |                  )
   46 |       root=i;
      |       ~~~~        
main.c:48:5: error: expected expression before '}' token
   48 |     }
      |     ^
main.c: At top level:
main.c:51:10: error: expected declaration specifiers or '...' before string constant
   51 |   printf("Preorder\n");
      |          ^~~~~~~~~~~~
main.c:52:3: warning: data definition has no type or storage class
   52 |   preorder(root);
      |   ^~~~~~~~
main.c:52:3: error: type defaults to 'int' in declaration of 'preorder' [-Wimplicit-int]
main.c:52:3: error: parameter names (without types) in function declaration [-Wdeclaration-missing-parameter-type]
main.c:52:3: error: conflicting types for 'preorder'; have 'int()'
main.c:11:6: note: previous declaration of 'preorder' with type 'void(int)'
   11 | void preorder(int u);
      |      ^~~~~~~~
main.c:53:10: error: expected declaration specifiers or '...' before string constant
   53 |   printf("\n");
      |          ^~~~
main.c:54:10: error: expected declaration specifiers or '...' before string constant
   54 |   printf("Inorder\n");
      |          ^~~~~~~~~~~
main.c:55:3: warning: data definition has no type or storage class
   55 |   inorder(root);
      |   ^~~~~~~
main.c:55:3: error: type defaults to 'int' in declaration of 'inorder' [-Wimplicit-int]
main.c:55:3: error: parameter names (without types) in function declaration [-Wdeclaration-missing-parameter-type]
main.c:55:3: error: conflicting types for 'inorder'; have 'int()'
main.c:12:6: note: previous declaration of 'inorder' with type 'void(int)'
   12 | void inorder(int u);
      |      ^~~~~~~
main.c:56:10: error: expected declaration specifiers or '...' before string constant
   56 |   printf("\n");
      |          ^~~~
main.c:57:10: error: expected declaration specifiers or '...' before string constant
   57 |   printf("Postorder\n");
      |          ^~~~~~~~~~~~~
main.c:58:3: warning: data definition has no type or storage class
   58 |   postorder(root);
      |   ^~~~~~~~~
main.c:58:3: error: type defaults to 'int' in declaration of 'postorder' [-Wimplicit-int]
main.c:58:3: error: parameter names (without types) in function declaration [-Wdeclaration-missing-parameter-type]
main.c:58:3: error: conflicting types for 'postorder'; have 'int()'
main.c:13:6: note: previous declaration of 'postorder' with type 'void(int)'
   13 | void postorder(int u);
      |      ^~~~~~~~~
main.c:59:10: error: expected declaration specifiers or '...' before string constant
   59 |   printf("\n");
      |          ^~~~
main.c:61:3: error: expected identifier or '(' before 'return'
   61 |   return 0;
      |   ^~~~~~
main.c:62:1: error: expected identifier or '(' before '}' token
   62 | }
      | ^
main.c: In function 'preorder':
main.c:68:15: error: invalid suffix "preorder" on integer constant
   68 |   if(T[u].l!=-1preorder(T[u].l);
      |               ^~~~~~~~~
main.c:68:32: error: expected ')' before ';' token
   68 |   if(T[u].l!=-1preorder(T[u].l);
      |     ~                          ^
      |                                )
main.c:69:15: error: invalid suffix "preorder" on integer constant
   69 |   if(T[u].r!=-1preorder(T[u].r);
      |               ^~~~~~~~~
main.c:75:15: error: invalid suffix "inorder" on integer constant
   75 |   if(T[u].l!=-1inorder(T[u].l);
      |               ^~~~~~~~
main.c:77:15: error: invalid suffix "inorder" on integer constant
   77 |   if(T[u].r!=-1inorder(T[u].r);
      |               ^~~~~~~~
main.c:82:15: error: invalid suffix "postorder" on integer constant
   82 |   if(T[u].l!=-1postorder(T[u].l);
      |               ^~~~~~~~~~
main.c:83:15: error: invalid suffix "postorder" on integer constant
   83 |   if(T[u].r!=-1postorder(T[u].r);
      |               ^~~~~~~~~~
main.c:86:1: error: expected declaration or statement at end of input
   86 | }
      | ^