Language: C

int main(){
  int n, i, j, v, v2;
  int id, k;


  scanf("%d", &n);

  //T = (Node *)malloc(sizeof(Node) * 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%d", &id, &k);
    T[id].k = k;
     for(j=0; j<T[id].k; j++){
       scanf("%d", &v);
      if(j == 0){
	T[id].left = v;
	T[v].parent = id;
	v2 = v;
      }else{
	T[v].parent = id;
	T[v2].right = v;
	v2 = v; 
      }
     }
  }
  
  for(i=0; i<n; i++){
    printf("node %d: parent = %d, depth = %d, ", i, T[i].parent, calculateDepth(i));
    PrintType(i);
    PrintDegree(i);
  }

  return 0;
}

int calculateDepth(int n){
  int i, parent;

  if(T[n].parent == -1) return 0;

  parent = T[n].parent;

  for(i=1; T[parent].parent != -1; i++){
    parent = T[parent].parent;
  }
  return i;

}

void PrintType(int n){
  if(T[n].parent == -1) printf("root, ");
  else if(T[n].left == -1) printf("leaf, ");
  else printf("internal node, ");
}

void PrintDegree(int n){
  int i, right;

  printf("[");

  for(i=0; i<T[n].k; i++){

    if(T[n].k == 1){
      printf("%d",T[n].left);
      break;
    }

    if(i == 0){
      printf("%d", T[n].left);
      right = T[T[n].left].right;
    }else if( i == T[n].k - 1){
      printf("%d", right);
      break;
    }else{
      printf("%d", right);
      right = T[right].right;
    }
    printf(", ");
  }

  printf("]\n");

}

Compiler output:
main.c: In function 'main':
main.c:6:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    6 |   scanf("%d", &n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int main(){
main.c:6:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    6 |   scanf("%d", &n);
      |   ^~~~~
main.c:6:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:11:5: error: 'T' undeclared (first use in this function)
   11 |     T[i].parent = -1;
      |     ^
main.c:11:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:34:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   34 |     printf("node %d: parent = %d, depth = %d, ", i, T[i].parent, calculateDepth(i));
      |     ^~~~~~
main.c:34:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:34:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:34:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:34:66: error: implicit declaration of function 'calculateDepth' [-Wimplicit-function-declaration]
   34 |     printf("node %d: parent = %d, depth = %d, ", i, T[i].parent, calculateDepth(i));
      |                                                                  ^~~~~~~~~~~~~~
main.c:35:5: error: implicit declaration of function 'PrintType' [-Wimplicit-function-declaration]
   35 |     PrintType(i);
      |     ^~~~~~~~~
main.c:36:5: error: implicit declaration of function 'PrintDegree' [-Wimplicit-function-declaration]
   36 |     PrintDegree(i);
      |     ^~~~~~~~~~~
main.c: In function 'calculateDepth':
main.c:45:6: error: 'T' undeclared (first use in this function)
   45 |   if(T[n].parent == -1) return 0;
      |      ^
main.c: At top level:
main.c:56:6: warning: conflicting types for 'PrintType'; have 'void(int)'
   56 | void PrintType(int n){
      |      ^~~~~~~~~
main.c:35:5: note: previous implicit declaration of 'PrintType' with type 'void(int)'
   35 |     PrintType(i);
      |     ^~~~~~~~~
main.c: In function 'PrintType':
main.c:57:6: error: 'T' undeclared (first use in this function)
   57 |   if(T[n].parent == -1) printf("root, ");
      |      ^
main.c:57:25: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   57 |   if(T[n].parent == -1) printf("root, ");
      |                         ^~~~~~
main.c:57:25: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:58:28: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   58 |   else if(T[n].left == -1) printf("leaf, ");
      |                            ^~~~~~
main.c:58:28: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:59:8: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   59 |   else printf("internal node, ");
      |        ^~~~~~
main.c:59:8: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:62:6: warning: conflicting types for 'PrintDegree'; have 'void(int)'
   62 | void PrintDegree(int n){
      |      ^~~~~~~~~~~
main.c:36:5: note: previous implicit declaration of 'PrintDegree' with type 'void(int)'
   36 |     PrintDegree(i);
      |     ^~~~~~~~~~~
main.c: In function 'PrintDegree':
main.c:65:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   65 |   printf("[");
      |   ^~~~~~
main.c:65:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:67:14: error: 'T' undeclared (first use in this function)
   67 |   for(i=0; i<T[n].k; i++){
      |              ^