From 6073724ccc19cf1481c563b7c0e50b1d6cdd8b11 Mon Sep 17 00:00:00 2001 From: Michal Utlak Date: Tue, 23 Apr 2024 19:40:18 +0200 Subject: [PATCH] skuska 4 --- a3/binary_search_tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/a3/binary_search_tree.c b/a3/binary_search_tree.c index debef5a..daa541d 100644 --- a/a3/binary_search_tree.c +++ b/a3/binary_search_tree.c @@ -13,7 +13,8 @@ node_t *build_tree(int *tree_data, size_t tree_data_len){ if(tree_data != NULL && tree_data_len != 0){ koren->data = tree_data[0]; - koren->left = (node_t *)tree_data[0]; + koren->left = (node_t *)malloc(sizeof(node_t)); + koren->left->data = tree_data[0]; } return koren;