Language: C

int count=0;

int main(){
    int n,i,j,node,k,child,l;
    int d=0;
    scanf("%d",&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",&node,&k);
        for(j=0;j<k;j++){
            scanf("%d",&child);
            
            if(j==0){
                T[node].left=child;
            }
            else{
                T[l].right=child;
            }
            l=child;
            T[child].parent=node;
        }
    }
    for(i=0;i<n;i++){
        d=0;
        printf("node %d: parent = %d, depth = %d, ",i,T[i].parent,getdepth(i));
        if(T[i].parent==-1){
            printf("root, [");
        }
        else if(T[i].left==-1)printf("leaf, [");
        else{
            printf("internal node, [");
        }
        print(T[i].left);
        count=0;
        printf("]\n");
    }
    
    return 0;
    
}
int getdepth(int a){
    int d=0;
    while(T[a].parent!=-1){
        a=T[a].parent;
        d++;
    }
    return d;
}

void print(int t){
    
    if(t!=-1){
        if(count!=0){
            printf(", ");
        }
        count++;
        printf("%d",t);
        print(T[t].right);
    }
}

Compiler output:
main.c: In function 'main':
main.c:6:5: 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 count=0;
main.c:6:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    6 |     scanf("%d",&n);
      |     ^~~~~
main.c:6:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:9:9: error: 'T' undeclared (first use in this function)
    9 |         T[i].parent=-1;
      |         ^
main.c:9:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:30:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   30 |         printf("node %d: parent = %d, depth = %d, ",i,T[i].parent,getdepth(i));
      |         ^~~~~~
main.c:30:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:30:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:30:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:30:67: error: implicit declaration of function 'getdepth' [-Wimplicit-function-declaration]
   30 |         printf("node %d: parent = %d, depth = %d, ",i,T[i].parent,getdepth(i));
      |                                                                   ^~~~~~~~
main.c:38:9: error: implicit declaration of function 'print' [-Wimplicit-function-declaration]
   38 |         print(T[i].left);
      |         ^~~~~
main.c: In function 'getdepth':
main.c:48:11: error: 'T' undeclared (first use in this function)
   48 |     while(T[a].parent!=-1){
      |           ^
main.c: At top level:
main.c:55:6: warning: conflicting types for 'print'; have 'void(int)'
   55 | void print(int t){
      |      ^~~~~
main.c:38:9: note: previous implicit declaration of 'print' with type 'void(int)'
   38 |         print(T[i].left);
      |         ^~~~~
main.c: In function 'print':
main.c:59:13: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   59 |             printf(", ");
      |             ^~~~~~
main.c:59:13: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:62:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   62 |         printf("%d",t);
      |         ^~~~~~
main.c:62:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:63:15: error: 'T' undeclared (first use in this function)
   63 |         print(T[t].right);
      |               ^