Code:
$ gcc -Wall foo.c
foo.c: In function ‘print_tree’:
foo.c:19:23: warning: comparison between pointer and integer
19 | if (root->left_edge != NULL){
| ^~
foo.c:20:20: warning: passing argument 1 of ‘print_tree’ makes pointer from integer without a cast [-Wint-conversion]
20 | print_tree(root->left_edge);
| ~~~~^~~~~~~~~~~
| |
| unsigned char:1
foo.c:17:23: note: expected ‘node *’ {aka ‘struct Node *’} but argument is of type ‘unsigned char:1’
17 | void print_tree(node* root){
| ~~~~~~^~~~
foo.c:22:24: warning: comparison between pointer and integer
22 | if (root->right_edge != NULL){
| ^~
foo.c:23:20: warning: passing argument 1 of ‘print_tree’ makes pointer from integer without a cast [-Wint-conversion]
23 | print_tree(root->right_edge);
| ~~~~^~~~~~~~~~~~
| |
| unsigned char:1
foo.c:17:23: note: expected ‘node *’ {aka ‘struct Node *’} but argument is of type ‘unsigned char:1’
17 | void print_tree(node* root){
| ~~~~~~^~~~
foo.c: In function ‘main’:
foo.c:33:20: warning: initialization of ‘unsigned char:1’ from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
33 | node a = {1,NULL,NULL};
| ^~~~
foo.c:33:20: note: (near initialization for ‘a.left_edge’)
foo.c:34:20: warning: initialization of ‘unsigned char:1’ from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
34 | node b = {2,NULL,NULL};
| ^~~~
foo.c:34:20: note: (near initialization for ‘b.left_edge’)
foo.c:35:20: warning: initialization of ‘unsigned char:1’ from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
35 | node c = {3,NULL,NULL};
| ^~~~
foo.c:35:20: note: (near initialization for ‘c.left_edge’)
foo.c:36:20: warning: initialization of ‘unsigned char:1’ from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
36 | node d = {4,NULL,NULL};
| ^~~~
foo.c:36:20: note: (near initialization for ‘d.left_edge’)
foo.c:37:20: warning: initialization of ‘unsigned char:1’ from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
37 | node e = {5,NULL,NULL};
| ^~~~
foo.c:37:20: note: (near initialization for ‘e.left_edge’)
foo.c:38:20: warning: initialization of ‘unsigned char:1’ from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
38 | node f = {6,NULL,NULL};
| ^~~~
foo.c:38:20: note: (near initialization for ‘f.left_edge’)
foo.c:39:20: warning: initialization of ‘unsigned char:1’ from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
39 | node g = {7,NULL,NULL};
| ^~~~
foo.c:39:20: note: (near initialization for ‘g.left_edge’)
foo.c:40:20: warning: initialization of ‘unsigned char:1’ from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
40 | node h = {8,NULL,NULL};
| ^~~~
foo.c:40:20: note: (near initialization for ‘h.left_edge’)
foo.c:43:26: warning: initialization of ‘unsigned char:1’ from ‘node *’ {aka ‘struct Node *’} makes integer from pointer without a cast [-Wint-conversion]
43 | node inner_3 = {0, &a, &b, 0, 1};
| ^
foo.c:43:26: note: (near initialization for ‘inner_3.left_edge’)
foo.c:44:26: warning: initialization of ‘unsigned char:1’ from ‘node *’ {aka ‘struct Node *’} makes integer from pointer without a cast [-Wint-conversion]
44 | node inner_4 = {0, &c, &d, 1, 0};
| ^
foo.c:44:26: note: (near initialization for ‘inner_4.left_edge’)
foo.c:44:30: warning: initialization of ‘struct Node *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
44 | node inner_4 = {0, &c, &d, 1, 0};
| ^
foo.c:44:30: note: (near initialization for ‘inner_4.right’)
foo.c:45:26: warning: initialization of ‘unsigned char:1’ from ‘node *’ {aka ‘struct Node *’} makes integer from pointer without a cast [-Wint-conversion]
45 | node inner_5 = {0, &e, &f, 1, 0};
| ^
foo.c:45:26: note: (near initialization for ‘inner_5.left_edge’)
foo.c:45:30: warning: initialization of ‘struct Node *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
45 | node inner_5 = {0, &e, &f, 1, 0};
| ^
foo.c:45:30: note: (near initialization for ‘inner_5.right’)
foo.c:46:26: warning: initialization of ‘unsigned char:1’ from ‘node *’ {aka ‘struct Node *’} makes integer from pointer without a cast [-Wint-conversion]
46 | node inner_6 = {0, &g, &h, 1, 0};
| ^
foo.c:46:26: note: (near initialization for ‘inner_6.left_edge’)
foo.c:46:30: warning: initialization of ‘struct Node *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
46 | node inner_6 = {0, &g, &h, 1, 0};
| ^
foo.c:46:30: note: (near initialization for ‘inner_6.right’)
foo.c:49:32: warning: initialization of ‘unsigned char:1’ from ‘node *’ {aka ‘struct Node *’} makes integer from pointer without a cast [-Wint-conversion]
49 | node inner_2 = {0, &inner_5, &inner_6, 1, 0};
| ^
foo.c:49:32: note: (near initialization for ‘inner_2.left_edge’)
foo.c:49:42: warning: initialization of ‘struct Node *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
49 | node inner_2 = {0, &inner_5, &inner_6, 1, 0};
| ^
foo.c:49:42: note: (near initialization for ‘inner_2.right’)
foo.c:52:22: warning: assignment to ‘unsigned char:1’ from ‘node *’ {aka ‘struct Node *’} makes integer from pointer without a cast [-Wint-conversion]
52 | inner_1->left_edge = &inner_3;
| ^
foo.c:53:23: warning: assignment to ‘unsigned char:1’ from ‘node *’ {aka ‘struct Node *’} makes integer from pointer without a cast [-Wint-conversion]
53 | inner_1->right_edge = &inner_4;
| ^
foo.c:55:19: warning: initialization of ‘struct Node *’ from incompatible pointer type ‘node **’ {aka ‘struct Node **’} [-Wincompatible-pointer-types]
55 | node root = {0, &inner_1, &inner_2, 0, 1};
| ^
foo.c:55:19: note: (near initialization for ‘root.left’)
foo.c:55:29: warning: initialization of ‘unsigned char:1’ from ‘node *’ {aka ‘struct Node *’} makes integer from pointer without a cast [-Wint-conversion]
55 | node root = {0, &inner_1, &inner_2, 0, 1};
| ^
foo.c:55:29: note: (near initialization for ‘root.left_edge’)
That left_edge / right_edge stuff is complete junk, it needs to go.