Language: C

#include<stdio.h>
#include<stdlib.h>

typedef struct node{
  int id;
  int p;
  int d;
  char type;
  int k;
  struct node *c;
  struct node *next;
  struct node *pre;
}T;

int n;

int main()
{
  int i,j,n_id,chil;
  T x;

  scanf("%d",&n);

  T t[n];

  for(i=0; i<n; i++){
    t[i]->d = 0;
  }

  for(i=0 i<n; i++){
    scanf("%d",&n_id);
    scanf("%d",&t[n_id]->k);

    t[n_id]->id = n_id;

    if(t[n_id].k==0){
      t[n_id].type = 'l';
      t[n_id]->c == NULL;
      continue;
    }
    else{
      t[n_id].type = 'i';
    }

    for(j=0; j<t[n_id]->k; j++){
      scanf("%d",&chil);
      t[chil]->p = n_id;
      t[chil]->d = t[n_id]->d + 1;
      if(j==0){
	t[n_id]->c = t[chil];
	t[n_id]->c->next = NULL;
	t[n_id]->c->pre = NULL;
	x = t[n_id]->c;
      } else {
	x->next = t[chil];
	x->pre = x;
	x = x->next;
      }
      while(x->pre == NULL){
	x = x->pre;
      }
      t[n_id]->c = x;
    }
  }

  for(i=0; i<n; i++){
    if(t[i]->d == 0){
      t[i]->type = 'r';
      t[i]->p = -1;
    }
    printf("node %d: parent = %d, depth = %d, ",t[i]->id, t[i]->p, t[i]->d);

    switch(t[i]->type){

    case 'l':
      printf("leaf, []\n");
      break;

    case 'i':
      printf("internal node, [");
      x = t[i]->c;
      for(j=0; j<t[i]->k-1; j++){
	printf("%d, ",x->id);
	x = x->next;
      }
      printf("%d]\n",x->id);
      break;

    case 'r':
      printf("root, [");
      x = t[i]->c;
      for(j=0; j<t[i].k; j++){
	if(j!=0)
	  printf(", ");
	printf("%d",x);
	x = x->next;
      }
      printf("]\n");
      break;
    }
  }

  
  return 0;
}

    
    
  
  



Compiler output:
main.c: In function 'main':
main.c:27:9: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   27 |     t[i]->d = 0;
      |         ^~
main.c:30:10: error: expected ';' before 'i'
   30 |   for(i=0 i<n; i++){
      |          ^~
      |          ;
main.c:30:19: error: expected ';' before ')' token
   30 |   for(i=0 i<n; i++){
      |                   ^
      |                   ;
main.c:32:24: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   32 |     scanf("%d",&t[n_id]->k);
      |                        ^~
main.c:34:12: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   34 |     t[n_id]->id = n_id;
      |            ^~
main.c:38:14: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   38 |       t[n_id]->c == NULL;
      |              ^~
main.c:45:23: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   45 |     for(j=0; j<t[n_id]->k; j++){
      |                       ^~
main.c:47:14: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   47 |       t[chil]->p = n_id;
      |              ^~
main.c:48:14: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   48 |       t[chil]->d = t[n_id]->d + 1;
      |              ^~
main.c:48:27: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   48 |       t[chil]->d = t[n_id]->d + 1;
      |                           ^~
main.c:50:16: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   50 |         t[n_id]->c = t[chil];
      |                ^~
main.c:51:16: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   51 |         t[n_id]->c->next = NULL;
      |                ^~
main.c:52:16: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   52 |         t[n_id]->c->pre = NULL;
      |                ^~
main.c:53:20: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   53 |         x = t[n_id]->c;
      |                    ^~
main.c:55:10: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   55 |         x->next = t[chil];
      |          ^~
main.c:56:10: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   56 |         x->pre = x;
      |          ^~
main.c:57:14: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   57 |         x = x->next;
      |              ^~
main.c:59:14: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   59 |       while(x->pre == NULL){
      |              ^~
main.c:60:14: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   60 |         x = x->pre;
      |              ^~
main.c:62:14: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   62 |       t[n_id]->c = x;
      |              ^~
main.c:67:12: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   67 |     if(t[i]->d == 0){
      |            ^~
main.c:68:11: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   68 |       t[i]->type = 'r';
      |           ^~
main.c:69:11: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   69 |       t[i]->p = -1;
      |           ^~
main.c:71:53: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   71 |     printf("node %d: parent = %d, depth = %d, ",t[i]->id, t[i]->p, t[i]->d);
      |                                                     ^~
main.c:71:63: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   71 |     printf("node %d: parent = %d, depth = %d, ",t[i]->id, t[i]->p, t[i]->d);
      |                                                               ^~
main.c:71:72: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   71 |     printf("node %d: parent = %d, depth = %d, ",t[i]->id, t[i]->p, t[i]->d);
      |                                                                        ^~
main.c:73:16: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   73 |     switch(t[i]->type){
      |                ^~
main.c:81:15: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   81 |       x = t[i]->c;
      |               ^~
main.c:82:22: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   82 |       for(j=0; j<t[i]->k-1; j++){
      |                      ^~
main.c:83:24: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   83 |         printf("%d, ",x->id);
      |                        ^~
main.c:84:14: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   84 |         x = x->next;
      |              ^~
main.c:86:23: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   86 |       printf("%d]\n",x->id);
      |                       ^~
main.c:91:15: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   91 |       x = t[i]->c;
      |               ^~
main.c:96:14: error: invalid type argument of '->' (have 'T' {aka 'struct node'})
   96 |         x = x->next;
      |              ^~