Language: C

#include<stdio.h>

#define N 100000
#define NIL -1

struct Node{
  int p,l,r;
};
/*
p:parent
l:left-child
r:right sibling
*/
struct Node T[N];

int n,D[N],H[N];
void print(int);



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

void print(int u){
  printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",u,parent(u),sibling(u),degree(u),D[u],hantei(u));
 hairetu(u);
}

int parerent(int u){
  int i;
  if(u==M)
    return -1;
  else {
    for(i=0;i<n;i++){
      if(T[i].l==u || T[i].r == u){
	return T[i].p;
	break;
      }
    }
  }
}
void hantei(int u){
 if(getDepth(a) == 0){
    printf("root\n");
  }
// leaf
  else if(T[a].r ==NIL && T[a].l ==NIL){
      printf("leaf\n");
    }
  
  // internal node
  else if(T[a].r!=NIL || T[a].l!= NIL){
    printf("internal node\n"); 
  }
}
int sibling(int m){
  int i;
  if(m==
  for(i=0;i<n;i++){
    if(T[i].l == m){
    return T[i].r;
      }
      if(T[i].r == m){
    return T[i].l;
      }
  }
     }
}

int height(int c){
  int l=0;
  int r=0;

  if(T[c].l==-1 && T[c].r == -1){
    return 0;
  }
  if(T[c].l!=-1 && T[c].r != -1){
    l = height(T[c].l)+1;
    r = height(T[c].r)+1;
    if(l<r){
      return r;
    }
    else return l;
  }
  else if(T[c].l==-1&&T[c].r!=-1){
    return height(T[c].r)+1;
  }
  else if(T[c].l!=-1&&T[c].r==-1){
    return height(T[c].l)+1;
  }
}

Compiler output:
main.c:21:1: error: return type defaults to 'int' [-Wimplicit-int]
   21 | main(){
      | ^~~~
main.c: In function 'print':
main.c:37:89: error: implicit declaration of function 'parent'; did you mean 'print'? [-Wimplicit-function-declaration]
   37 |   printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",u,parent(u),sibling(u),degree(u),D[u],hantei(u));
      |                                                                                         ^~~~~~
      |                                                                                         print
main.c:37:99: error: implicit declaration of function 'sibling' [-Wimplicit-function-declaration]
   37 |   printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",u,parent(u),sibling(u),degree(u),D[u],hantei(u));
      |                                                                                                   ^~~~~~~
main.c:37:110: error: implicit declaration of function 'degree' [-Wimplicit-function-declaration]
   37 |   printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",u,parent(u),sibling(u),degree(u),D[u],hantei(u));
      |                                                                                                              ^~~~~~
main.c:37:125: error: implicit declaration of function 'hantei' [-Wimplicit-function-declaration]
   37 |   printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",u,parent(u),sibling(u),degree(u),D[u],hantei(u));
      |                                                                                                                             ^~~~~~
main.c:38:2: error: implicit declaration of function 'hairetu' [-Wimplicit-function-declaration]
   38 |  hairetu(u);
      |  ^~~~~~~
main.c: In function 'parerent':
main.c:43:9: error: 'M' undeclared (first use in this function)
   43 |   if(u==M)
      |         ^
main.c:43:9: note: each undeclared identifier is reported only once for each function it appears in
main.c: At top level:
main.c:54:6: warning: conflicting types for 'hantei'; have 'void(int)'
   54 | void hantei(int u){
      |      ^~~~~~
main.c:37:125: note: previous implicit declaration of 'hantei' with type 'void(int)'
   37 |   printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",u,parent(u),sibling(u),degree(u),D[u],hantei(u));
      |                                                                                                                             ^~~~~~
main.c: In function 'hantei':
main.c:55:5: error: implicit declaration of function 'getDepth' [-Wimplicit-function-declaration]
   55 |  if(getDepth(a) == 0){
      |     ^~~~~~~~
main.c:55:14: error: 'a' undeclared (first use in this function)
   55 |  if(getDepth(a) == 0){
      |              ^
main.c: In function 'sibling':
main.c:71:3: error: expected expression before 'for'
   71 |   for(i=0;i<n;i++){
      |   ^~~
main.c:79:6: error: expected expression before '}' token
   79 |      }
      |      ^
main.c: At top level:
main.c:80:1: error: expected identifier or '(' before '}' token
   80 | }
      | ^