From 42ef7de47eaaad9f2e5d4babcdf5b08d310931dc Mon Sep 17 00:00:00 2001 From: Kozar Date: Tue, 12 Nov 2024 16:20:56 +0000 Subject: [PATCH] Initializacia --- cv7/program.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cv7/program.c b/cv7/program.c index 266a371..835db5e 100644 --- a/cv7/program.c +++ b/cv7/program.c @@ -42,7 +42,13 @@ void run_tree(struct tree* tree) { } if (tree->value[0] == '*') { - printf("*%s\nKoniec\n", tree->value + 1); + // If the node starts with *, check for children + if (tree->left || tree->right) { + printf("Expert z bufetu to vie.\nChybna databaza\n"); + } else { + // If no children, it's the end of a branch + printf("*%s\nKoniec\n", tree->value + 1); + } return; } @@ -64,6 +70,7 @@ void run_tree(struct tree* tree) { } } + void destroy_tree(struct tree* tree) { if (tree->left != NULL) { destroy_tree(tree->left);