diff --git a/exercises/02/vslc/src/tree.c b/exercises/02/vslc/src/tree.c index 678888f..25aab7a 100644 --- a/exercises/02/vslc/src/tree.c +++ b/exercises/02/vslc/src/tree.c @@ -20,7 +20,8 @@ print_syntax_tree ( void ) } -void +// Changed so it returns the pointer to the new node, can be used as before, but makes the parser file cleaner +node_t* node_init (node_t *nd, node_index_t type, void *data, uint64_t n_children, ...) { // Copy the type @@ -45,6 +46,8 @@ node_init (node_t *nd, node_index_t type, void *data, uint64_t n_children, ...) // Populate the memory with pointers to children for (int i = 0; i < n_children; i++) nd->children[i] = va_arg(list_children, node_t*); + + return nd; }