Language: C

#include <stdio.h>
struct node{int p,l,r;};
node t[25];
int n,h[25],d[25];
void dp1(int now,int de){
  d[now]=de;
  if(t[now].l!=-1) dp1(t[now].l,de+1);
  if(t[now].r!=-1) dp1(t[now].r,de);
}
void dp2(int f,int now,int he){
  if(h[f]<he) h[f]=he;
  if(t[now].l!=-1) dp2(f,t[now].l,he+1);
  if(t[now].l!=-1) if(t[t[now].l].r!=-1) dp2(f,t[t[now].l].r,he+1);
}
int main(){
  int now,tmpl,tmpr,s[25]={0},p[25];
  scanf("%d",&n);
  for(int i=0;i<n;i++) t[i].p=t[i].l=t[i].r=p[i]=-1;
  for(int i=0;i<n;i++){
    scanf("%d%d%d",&now,&tmpl,&tmpr);
    if(tmpl==-1) tmpl=tmpr,tmpr=-1;
    if(tmpl!=-1) s[now]++,t[tmpl].p=now,t[tmpl].r=tmpr;
    if(tmpr!=-1) s[now]++,t[tmpr].p=now;
    t[now].l=tmpl;
  }
  for(int i=0;i<n;i++){
    if(t[i].r!=-1) p[i]=t[i].r;
    else if(t[i].p!=-1) if(t[t[i].p].l!=-1&&t[t[i].p].l!=i) p[i]=t[t[i].p].l;
  }
  int st;
  for(int i=0;i<n;i++) if(t[i].p==-1) st=i;
  dp1(st,0);
  for(int i=0;i<n;i++) dp2(i,i,0);
  for(int i=0;i<n;i++){
    printf("node %d: parent = %d, sibling = %d, ",i,t[i].p,p[i]);
    printf("degree = %d, depth = %d, height = %d, ",s[i],d[i],h[i]);
    if(t[i].p==-1) printf("root\n");
    else if(t[i].l!=-1) printf("internal node\n");
    else printf("leaf\n");
  }
  return 0;
}

Compiler output:
main.c:3:1: error: unknown type name 'node'; use 'struct' keyword to refer to the type
    3 | node t[25];
      | ^~~~
      | struct 
main.c: In function 'dp1':
main.c:7:12: error: request for member 'l' in something not a structure or union
    7 |   if(t[now].l!=-1) dp1(t[now].l,de+1);
      |            ^
main.c:7:30: error: request for member 'l' in something not a structure or union
    7 |   if(t[now].l!=-1) dp1(t[now].l,de+1);
      |                              ^
main.c:8:12: error: request for member 'r' in something not a structure or union
    8 |   if(t[now].r!=-1) dp1(t[now].r,de);
      |            ^
main.c:8:30: error: request for member 'r' in something not a structure or union
    8 |   if(t[now].r!=-1) dp1(t[now].r,de);
      |                              ^
main.c: In function 'dp2':
main.c:12:12: error: request for member 'l' in something not a structure or union
   12 |   if(t[now].l!=-1) dp2(f,t[now].l,he+1);
      |            ^
main.c:12:32: error: request for member 'l' in something not a structure or union
   12 |   if(t[now].l!=-1) dp2(f,t[now].l,he+1);
      |                                ^
main.c:13:12: error: request for member 'l' in something not a structure or union
   13 |   if(t[now].l!=-1) if(t[t[now].l].r!=-1) dp2(f,t[t[now].l].r,he+1);
      |            ^
main.c:13:31: error: request for member 'l' in something not a structure or union
   13 |   if(t[now].l!=-1) if(t[t[now].l].r!=-1) dp2(f,t[t[now].l].r,he+1);
      |                               ^
main.c:13:56: error: request for member 'l' in something not a structure or union
   13 |   if(t[now].l!=-1) if(t[t[now].l].r!=-1) dp2(f,t[t[now].l].r,he+1);
      |                                                        ^
main.c: In function 'main':
main.c:18:28: error: request for member 'p' in something not a structure or union
   18 |   for(int i=0;i<n;i++) t[i].p=t[i].l=t[i].r=p[i]=-1;
      |                            ^
main.c:18:35: error: request for member 'l' in something not a structure or union
   18 |   for(int i=0;i<n;i++) t[i].p=t[i].l=t[i].r=p[i]=-1;
      |                                   ^
main.c:18:42: error: request for member 'r' in something not a structure or union
   18 |   for(int i=0;i<n;i++) t[i].p=t[i].l=t[i].r=p[i]=-1;
      |                                          ^
main.c:22:34: error: request for member 'p' in something not a structure or union
   22 |     if(tmpl!=-1) s[now]++,t[tmpl].p=now,t[tmpl].r=tmpr;
      |                                  ^
main.c:22:48: error: request for member 'r' in something not a structure or union
   22 |     if(tmpl!=-1) s[now]++,t[tmpl].p=now,t[tmpl].r=tmpr;
      |                                                ^
main.c:23:34: error: request for member 'p' in something not a structure or union
   23 |     if(tmpr!=-1) s[now]++,t[tmpr].p=now;
      |                                  ^
main.c:24:11: error: request for member 'l' in something not a structure or union
   24 |     t[now].l=tmpl;
      |           ^
main.c:27:12: error: request for member 'r' in something not a structure or union
   27 |     if(t[i].r!=-1) p[i]=t[i].r;
      |            ^
main.c:27:29: error: request for member 'r' in something not a structure or union
   27 |     if(t[i].r!=-1) p[i]=t[i].r;
      |                             ^
main.c:28:17: error: request for member 'p' in something not a structure or union
   28 |     else if(t[i].p!=-1) if(t[t[i].p].l!=-1&&t[t[i].p].l!=i) p[i]=t[t[i].p].l;
      |                 ^
main.c:28:34: error: request for member 'p' in something not a structure or union
   28 |     else if(t[i].p!=-1) if(t[t[i].p].l!=-1&&t[t[i].p].l!=i) p[i]=t[t[i].p].l;
      |                                  ^
main.c:28:51: error: request for member 'p' in something not a structure or union
   28 |     else if(t[i].p!=-1) if(t[t[i].p].l!=-1&&t[t[i].p].l!=i) p[i]=t[t[i].p].l;
      |                                                   ^
main.c:28:72: error: request for member 'p' in something not a structure or union
   28 |     else if(t[i].p!=-1) if(t[t[i].p].l!=-1&&t[t[i].p].l!=i) p[i]=t[t[i].p].l;
      |                                                                        ^
main.c:31:31: error: request for member 'p' in something not a structure or union
   31 |   for(int i=0;i<n;i++) if(t[i].p==-1) st=i;
      |                               ^
main.c:35:57: error: request for member 'p' in something not a structure or union
   35 |     printf("node %d: parent = %d, sibling = %d, ",i,t[i].p,p[i]);
      |                                                         ^
main.c:37:12: error: request for member 'p' in something not a structure or union
   37 |     if(t[i].p==-1) printf("root\n");
      |            ^
main.c:38:17: error: request for member 'l' in something not a structure or union
   38 |     else if(t[i].l!=-1) printf("internal node\n");
      |                 ^