From d2efa5d900af6170a24b0589c2205dd08c04169a Mon Sep 17 00:00:00 2001 From: Kozar Date: Tue, 12 Nov 2024 13:00:16 +0000 Subject: [PATCH] Initializacia --- cv7/program.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cv7/program.c b/cv7/program.c index 657f883..551776a 100644 --- a/cv7/program.c +++ b/cv7/program.c @@ -37,11 +37,18 @@ struct tree* load_tree() { return NULL; } - if (node->value[0] != '*') { + if (node->value[0] != '*') { node->left = load_tree(); node->right = load_tree(); - if (!node->left || !node->right) { + if (!node->left || !node->right) { + destroy_tree(node); + return NULL; + } + } else { + struct tree* extra = read_tree(); + if (extra) { + free(extra); destroy_tree(node); return NULL; } @@ -54,6 +61,7 @@ struct tree* load_tree() { + void run_tree(struct tree* tree) { if (!tree) { return; @@ -105,7 +113,7 @@ int main() { struct tree* root = load_tree(); printf("Expert z bufetu to vie.\n"); - if (!root) { + if (!root) { printf("Chybna databaza\n"); return 0; } @@ -121,3 +129,4 @@ int main() { } +