From c4c808544fc80784343b649356859df10a7caf54 Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Sun, 22 Nov 2020 17:56:24 +0100 Subject: [PATCH] buffet --- cv8/program.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cv8/program.c b/cv8/program.c index 2d9dfb2..c52097e 100644 --- a/cv8/program.c +++ b/cv8/program.c @@ -17,7 +17,10 @@ struct tree* read_tree(){ int x = strlen(buffer); buffer[x-1]='\0'; - assert(r); + if(r == NULL){ + printf("Chybna databaza\n"); + exit(0); + } if(buffer[0] != '\0'){ struct tree* node = calloc(1,sizeof(struct tree)); @@ -132,12 +135,14 @@ int count_all(struct tree* node){ int main(){ + + printf("Expert z bufetu to vie.\n"); + struct tree* tree = NULL; tree = read_tree(); int count = count_leaves(tree); - printf("Expert z bufetu to vie.\n"); printf("Pozna %d druhov ovocia a zeleniny.\n", count); printf("Odpovedajte 'a' pre prvu moznost alebo 'n' pre druhu moznost.\n");