From 5c57c8a8daa109fcb38a843301a2fca2cc2be4c8 Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Sun, 22 Nov 2020 13:41:02 +0100 Subject: [PATCH] buffet --- cv8/program.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/cv8/program.c b/cv8/program.c index 5f55f07..f5e723c 100644 --- a/cv8/program.c +++ b/cv8/program.c @@ -30,8 +30,6 @@ struct tree* read_tree(){ node->right = read_tree(); } } - - //if(node->left != NULL && node->right != NULL){ return node; } @@ -39,11 +37,7 @@ struct tree* read_tree(){ struct tree* search(struct tree* this){ char c = getchar(); - /*char buffer[50]; - memset(buffer, 0, 50); - int x = strlen(buffer); - buffer[x-1]='\0'; - memcpy(buffer, this->value, 50); */ + if(this->left != NULL && this->right != NULL){ if(c == 'a'){ printf("%s\n", this->left); @@ -55,11 +49,6 @@ struct tree* search(struct tree* this){ } } - else { - //printf("%s\n", this->value); - printf("Koniec\n"); - return NULL; - } } @@ -112,7 +101,8 @@ int main(){ printf("Odpovedajte 'a' pre prvu moznost alebo 'n' pre druhu moznost.\n"); printf("%s\n", tree->value); tree = search(tree); - destroy_tree(tree); + destroy_tree(tree); + printf("Koniec\n"); return 0; }