Language: C

#include<stdio.h>
#define NIL -1;

typedef struct{
  int p;
  int left;
  int right;
}tree;

tree T[100001];
  int n; //接点の個数

int main(){
  int i,j;
  int id; //接点の番号
  int left,right; //左,右の子
  int s[10001],d[10001];
  
  scanf("%d",&n);
  for(i=0 ; i<n ; i++){
    d[i]=0;
    T[i].p=NIL;
    T[i].left=NIL;
    T[i].right=NIL;
    s[i]=NIL;
  }
  
  for(i=0 ; i<n ;i++){
    scanf("%d %d% d",&id,&left,&right);
    if(left!=NIL && right!=NIL){
      d[id] = 2;
      T[id].left = left;
      T[id].right = right;
      T[left].p = id;
      T[right].p = id;
      s[left] = right;
      s[right] = left;
    }
    else if(left!=NIL && right==NIL){
      d[id] = 1; 
      T[id].left = left;
      T[left].p = id;
    }
    else if(left==NIL && right!=NIL){
      d[id] = 1; 
      T[id].right = right;
      T[right].p = id;
    }
    else d[id] = 0;
  }

  for(i=0;i<n;i++){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,T[i].p,s[i],d[i],calcDepth(i),calcHeight(i));
    if(T[i].p==NIL) printf("root\n"); 
    else if(T[i].left==NIL && T[i].right==NIL) printf("leaf\n");
    else printf("internal node\n");
  }
  return 0;
}

int calcDepth(int id){
  if(T[id].p==NIL) return 0;
  return calcDepth(T[id].p)+1;
}
 
int calcHeight(int id){
  int i,c,q=0;
  for(i=0 ; i<n ; i++){
    if(T[i].p==id){
      c=1+calcHeight(i);
      if(q<c) q=c;
    }
  }
    return q;
}

Compiler output:
main.c: In function 'main':
main.c:2:15: error: expected ')' before ';' token
    2 | #define NIL -1;
      |               ^
main.c:30:14: note: in expansion of macro 'NIL'
   30 |     if(left!=NIL && right!=NIL){
      |              ^~~
main.c:30:7: note: to match this '('
   30 |     if(left!=NIL && right!=NIL){
      |       ^
main.c:2:15: error: expected ')' before ';' token
    2 | #define NIL -1;
      |               ^
main.c:39:19: note: in expansion of macro 'NIL'
   39 |     else if(left!=NIL && right==NIL){
      |                   ^~~
main.c:39:12: note: to match this '('
   39 |     else if(left!=NIL && right==NIL){
      |            ^
main.c:2:15: error: expected ')' before ';' token
    2 | #define NIL -1;
      |               ^
main.c:44:19: note: in expansion of macro 'NIL'
   44 |     else if(left==NIL && right!=NIL){
      |                   ^~~
main.c:44:12: note: to match this '('
   44 |     else if(left==NIL && right!=NIL){
      |            ^
main.c:53:108: error: implicit declaration of function 'calcDepth' [-Wimplicit-function-declaration]
   53 |     printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,T[i].p,s[i],d[i],calcDepth(i),calcHeight(i));
      |                                                                                                            ^~~~~~~~~
main.c:53:121: error: implicit declaration of function 'calcHeight' [-Wimplicit-function-declaration]
   53 |     printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,T[i].p,s[i],d[i],calcDepth(i),calcHeight(i));
      |                                                                                                                         ^~~~~~~~~~
main.c:2:15: error: expected ')' before ';' token
    2 | #define NIL -1;
      |               ^
main.c:54:16: note: in expansion of macro 'NIL'
   54 |     if(T[i].p==NIL) printf("root\n");
      |                ^~~
main.c:54:7: note: to match this '('
   54 |     if(T[i].p==NIL) printf("root\n");
      |       ^
main.c:2:15: error: expected ')' before ';' token
    2 | #define NIL -1;
      |               ^
main.c:55:24: note: in expansion of macro 'NIL'
   55 |     else if(T[i].left==NIL && T[i].right==NIL) printf("leaf\n");
      |                        ^~~
main.c:55:12: note: to match this '('
   55 |     else if(T[i].left==NIL && T[i].right==NIL) printf("leaf\n");
      |            ^
main.c: In function 'calcDepth':
main.c:2:15: error: expected ')' before ';' token
    2 | #define NIL -1;
      |               ^
main.c:62:15: note: in expansion of macro 'NIL'
   62 |   if(T[id].p==NIL) return 0;
      |               ^~~
main.c:62:5: note: to match this '('
   62 |   if(T[id].p==NIL) return 0;
      |     ^