From b640c1eb0e3f05e1b76f5f8af9d7f90fba1aa311 Mon Sep 17 00:00:00 2001 From: Bohdan Kapliuk Date: Thu, 14 Nov 2024 14:37:42 +0200 Subject: [PATCH] cv7 --- cv7/program.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cv7/program.c b/cv7/program.c index 937af61..5337ffc 100644 --- a/cv7/program.c +++ b/cv7/program.c @@ -15,12 +15,10 @@ struct tree* read_tree(int* counter) { memset(buffer, 0, SIZE); char* r = fgets(buffer, SIZE, stdin); if(r == NULL){ - printf("Expert z bufetu to vie.\n"); - printf("Chybna databaza\n"); - return NULL; + return 0; } if (buffer[0] == '\n') { - return NULL; + return 0; } struct tree* tree = calloc(1, sizeof(struct tree)); tree->value = malloc(strlen(buffer) + 1); @@ -71,6 +69,9 @@ int main() { printf("Pozna %d druhov ovocia a zeleniny.\n", counter); printf("Odpovedajte 'a' pre prvu moznost alebo 'n' pre druhu moznost.\n"); print_tree(root); + } else{ + printf("Expert z bufetu to vie.\n"); + printf("Chybna databaza\n"); } destroy_tree(root); return 0;