Language: C

#include <stdio.h>

#define MAX 100005
#define NIL -1

struct Node{
	int p, l, r;
};

Node T[MAX];
int n, D[MAX];

void print(int u){
	int i, c;

	printf("node %d : ", u);
	printf("parent = %d , ", T[u].p);
	printf("depth = %d , ", D[u]);

	if(T[u].p == NIL){
		printf("root, ");
	}else if(T[u].l == NIL){
		printf("leaf, ");
	}else{
		printf("internal node, ");
	}

	printf("[");

	for(i = 0, c = T[u].l; c != NIL; i++, c = T[c].r){
		if(i){
			printf(", ");
		}
		printf("%d\n", c);
	}
}

int rec(int u, int p){
	D[u] = p;
	if(T[u].r != NIL){
		rec(T[u].r, p);
	}
	if(T[u].l != NIL){
		rec(T[u].l, p + 1);
	}
}

int main(void){
	int i, j, d, v, c, l, r;

	scanf("%d", &u);

	for(i = 0; i < n; i++){
		T[i].r = NIL;
		T[i].l = T[i].r;
		T[i].p = T[i].l;
	}

	for(i = 0; i < n; i++){
		scanf("%d %d", &v, &d);
		if(f == 0){
			T[v].l = c;
		}else{
			T[l].r = c;
		}

		l = c;
		T[c].p = v;

	}

	for (int i = 0; i < n; i++){
		if(T[i].p == NIL){
			r = i;
		}
	}

	rec(r, 0);

	for (int i = 0; i < n; i++){
		print(i);
	}

	return 0;
}


Compiler output:
main.c:10:1: error: unknown type name 'Node'; use 'struct' keyword to refer to the type
   10 | Node T[MAX];
      | ^~~~
      | struct 
main.c: In function 'print':
main.c:17:38: error: request for member 'p' in something not a structure or union
   17 |         printf("parent = %d , ", T[u].p);
      |                                      ^
main.c:20:16: error: request for member 'p' in something not a structure or union
   20 |         if(T[u].p == NIL){
      |                ^
main.c:22:22: error: request for member 'l' in something not a structure or union
   22 |         }else if(T[u].l == NIL){
      |                      ^
main.c:30:28: error: request for member 'l' in something not a structure or union
   30 |         for(i = 0, c = T[u].l; c != NIL; i++, c = T[c].r){
      |                            ^
main.c:30:55: error: request for member 'r' in something not a structure or union
   30 |         for(i = 0, c = T[u].l; c != NIL; i++, c = T[c].r){
      |                                                       ^
main.c: In function 'rec':
main.c:40:16: error: request for member 'r' in something not a structure or union
   40 |         if(T[u].r != NIL){
      |                ^
main.c:41:25: error: request for member 'r' in something not a structure or union
   41 |                 rec(T[u].r, p);
      |                         ^
main.c:43:16: error: request for member 'l' in something not a structure or union
   43 |         if(T[u].l != NIL){
      |                ^
main.c:44:25: error: request for member 'l' in something not a structure or union
   44 |                 rec(T[u].l, p + 1);
      |                         ^
main.c: In function 'main':
main.c:51:22: error: 'u' undeclared (first use in this function)
   51 |         scanf("%d", &u);
      |                      ^
main.c:51:22: note: each undeclared identifier is reported only once for each function it appears in
main.c:54:21: error: request for member 'r' in something not a structure or union
   54 |                 T[i].r = NIL;
      |                     ^
main.c:55:21: error: request for member 'l' in something not a structure or union
   55 |                 T[i].l = T[i].r;
      |                     ^
main.c:55:30: error: request for member 'r' in something not a structure or union
   55 |                 T[i].l = T[i].r;
      |                              ^
main.c:56:21: error: request for member 'p' in something not a structure or union
   56 |                 T[i].p = T[i].l;
      |                     ^
main.c:56:30: error: request for member 'l' in something not a structure or union
   56 |                 T[i].p = T[i].l;
      |                              ^
main.c:61:20: error: 'f' undeclared (first use in this function)
   61 |                 if(f == 0){
      |                    ^
main.c:62:29: error: request for member 'l' in something not a structure or union
   62 |                         T[v].l = c;
      |                             ^
main.c:64:29: error: request for member 'r' in something not a structure or union
   64 |                         T[l].r = c;
      |                             ^
main.c:68:21: error: request for member 'p' in something not a structure or union
   68 |                 T[c].p = v;
      |                     ^
main.c:73:24: error: request for member 'p' in something not a structure or union
   73 |                 if(T[i].p == NIL){
      |                        ^