Language: C

#incluede <stdio.h>
#define MAX 100000
#define NIL -1
void setdepth(int int);
int setheight(int);
void print(int);
int getsibling(int);
struct Node{
  int p,l,r;
};

Node T[MAX];
int n,D[MAX];

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

  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;
  }
  
  setdepth(root,0);
  setheight(root);
  
  for(i=0;i<n;i++)
    print(i);
}

void setdepth(int u, int d){
  if(u==NIL) 
    return 0;
  D[u]=d;
  depth(T[u].l,d+1);
  depth(T[u].r,d+1);
}

int setheight(int u){
  int h1=0,h2=0;

  if(T[u].l!=NIL)
    h1=setheight(T[u].l)+1;
  if(T[u].r!=NIL)
    h2=setright(T[u].r)+1;
  
  if(h1>h2)
    return H[u]=h1;
  else
    return H[u]=h2;
}

void print(int u){
  int deg=0;

  printf("node %d: ",u);
  printf("parent = %d, ",T[u].p);
  printf("sibling = %d, ",getsibling(u));

  if(T[u].l!=NIL)
    deg++;
  if(T[u].r!=NIL)
    deg++;

  printf("degree = %d, ",deg);
  printf("depth = %d,",D[u]);
  printf("height = %d, ",H[u]);

  if(T[u].p==NIL)
    printf("root\n");
  else if(T[u].l==NIL && T[u].r==NIL)
    printf("leaf");
  else
    printf("internal node\n");
}

int getsibling(int u){
  if(T[u].p==NIL)
    return NIL;
  if(T[T[u].p].l!=u && T[T[u].p].l!=NIL)
    return T[T[u].p].l;
  if(T[T[u].p].r!=u && T[T[u].p].r!=NIL)
    return T[T[u].p].r;
  return NIL;
}

Compiler output:
main.c:1:2: error: invalid preprocessing directive #incluede; did you mean #include?
    1 | #incluede <stdio.h>
      |  ^~~~~~~~
      |  include
main.c:4:19: error: two or more data types in declaration specifiers
    4 | void setdepth(int int);
      |                   ^~~
main.c:12:1: error: unknown type name 'Node'; use 'struct' keyword to refer to the type
   12 | Node T[MAX];
      | ^~~~
      | struct 
main.c: In function 'main':
main.c:18:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   18 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | #incluede <stdio.h>
main.c:18:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   18 |   scanf("%d",&n);
      |   ^~~~~
main.c:18:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:21:9: error: request for member 'p' in something not a structure or union
   21 |     T[i].p=NIL;
      |         ^
main.c:26:9: error: request for member 'l' in something not a structure or union
   26 |     T[v].l=l;
      |         ^
main.c:27:9: error: request for member 'r' in something not a structure or union
   27 |     T[v].r=r;
      |         ^
main.c:29:11: error: request for member 'p' in something not a structure or union
   29 |       T[l].p=v;
      |           ^
main.c:31:11: error: request for member 'p' in something not a structure or union
   31 |       T[r].p=v;
      |           ^
main.c:35:12: error: request for member 'p' in something not a structure or union
   35 |     if(T[i].p==NIL)
      |            ^
main.c:39:3: error: too many arguments to function 'setdepth'
   39 |   setdepth(root,0);
      |   ^~~~~~~~
main.c:4:6: note: declared here
    4 | void setdepth(int int);
      |      ^~~~~~~~
main.c: At top level:
main.c:46:6: error: conflicting types for 'setdepth'; have 'void(int,  int)'
   46 | void setdepth(int u, int d){
      |      ^~~~~~~~
main.c:4:6: note: previous declaration of 'setdepth' with type 'void(int)'
    4 | void setdepth(int int);
      |      ^~~~~~~~
main.c: In function 'setdepth':
main.c:48:12: error: 'return' with a value, in function returning void [-Wreturn-mismatch]
   48 |     return 0;
      |            ^
main.c:46:6: note: declared here
   46 | void setdepth(int u, int d){
      |      ^~~~~~~~
main.c:50:3: error: implicit declaration of function 'depth'; did you mean 'setdepth'? [-Wimplicit-function-declaration]
   50 |   depth(T[u].l,d+1);
      |   ^~~~~
      |   setdepth
main.c:50:13: error: request for member 'l' in something not a structure or union
   50 |   depth(T[u].l,d+1);
      |             ^
main.c:51:13: error: request for member 'r' in something not a structure or union
   51 |   depth(T[u].r,d+1);
      |             ^
main.c: In function 'setheight':
main.c:57:10: error: request for member 'l' in something not a structure or union
   57 |   if(T[u].l!=NIL)
      |          ^
main.c:58:22: error: request for member 'l' in something not a structure or union
   58 |     h1=setheight(T[u].l)+1;
      |                      ^
main.c:59:10: error: request for member 'r' in something not a structure or union
   59 |   if(T[u].r!=NIL)
      |          ^
main.c:60:8: error: implicit declaration of function 'setright'; did you mean 'setheight'? [-Wimplicit-function-declaration]
   60 |     h2=setright(T[u].r)+1;
      |        ^~~~~~~~
      |        setheight
main.c:60:21: error: request for member 'r' in something not a structure or union
   60 |     h2=setright(T[u].r)+1;
      |                     ^
main.c:63:12: error: 'H' undeclared (first use in this function)
   63 |     return H[u]=h1;
      |            ^
main.c:63:12: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'print':
main.c:71:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   71 |   printf("node %d: ",u);
      |   ^~~~~~
main.c:71:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:71:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:71:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:72:30: error: request for member 'p' in something not a structure or union
   72 |   printf("parent = %d, ",T[u].p);
      |                              ^
main.c:75:10: error: request for member 'l' in something not a structure or union
   75 |   if(T[u].l!=NIL)
      |          ^
main.c:77:10: error: request for member 'r' in something not a structure or union
   77 |   if(T[u].r!=NIL)
      |          ^
main.c:82:26: error: 'H' undeclared (first use in this function)
   82 |   printf("height = %d, ",H[u]);
      |                          ^
main.c:84:10: error: request for member 'p' in something not a structure or union
   84 |   if(T[u].p==NIL)
      |          ^
main.c:86:15: error: request for member 'l' in something not a structure or union
   86 |   else if(T[u].l==NIL && T[u].r==NIL)
      |               ^
main.c:86:30: error: request for member 'r' in something not a structure or union
   86 |   else if(T[u].l==NIL && T[u].r==NIL)
      |                              ^
main.c: In function 'getsibling':
main.c:93:10: error: request for member 'p' in something not a structure or union
   93 |   if(T[u].p==NIL)
      |          ^
main.c:95:12: error: request for member 'p' in something not a structure or union
   95 |   if(T[T[u].p].l!=u && T[T[u].p].l!=NIL)
      |            ^
main.c:95:30: error: request for member 'p' in something not a structure or union
   95 |   if(T[T[u].p].l!=u && T[T[u].p].l!=NIL)
      |                              ^
main.c:96:18: error: request for member 'p' in something not a structure or union
   96 |     return T[T[u].p].l;
      |                  ^
main.c:97:12: error: request for member 'p' in something not a structure or union
   97 |   if(T[T[u].p].r!=u && T[T[u].p].r!=NIL)
      |            ^
main.c:97:30: error: request for member 'p' in something not a structure or union
   97 |   if(T[T[u].p].r!=u && T[T[u].p].r!=NIL)
      |                              ^
main.c:98:18: error: request for member 'p' in something not a structure or union
   98 |     return T[T[u].p].r;
      |                  ^