This commit is contained in:
Maryna Kravtsova 2020-11-22 13:41:02 +01:00
parent 5f846d7771
commit 5c57c8a8da

View File

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