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; }