From 87a8c885816d7ab018b9d279061a1232ae011f77 Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Sun, 22 Nov 2020 13:28:03 +0100 Subject: [PATCH] buffet --- cv8/program.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cv8/program.c b/cv8/program.c index e922217..f161177 100644 --- a/cv8/program.c +++ b/cv8/program.c @@ -18,8 +18,8 @@ struct tree* read_tree(){ buffer[x-1]='\0'; assert(r); + if(buffer[0] != '\0'){ - struct tree* node = calloc(1,sizeof(struct tree)); memcpy(node->value, buffer,50); if(buffer[0] != '*'){ @@ -29,11 +29,12 @@ struct tree* read_tree(){ if(node->right == NULL){ node->right = read_tree(); } - } + } + //if(node->left != NULL && node->right != NULL){ return node; } - // } + } struct tree* search(struct tree* this){ @@ -43,7 +44,7 @@ struct tree* search(struct tree* this){ int x = strlen(buffer); buffer[x-1]='\0'; memcpy(buffer, this->value, 50); */ - if(this != NULL){ + if(this->left != NULL && this->right != NULL){ if(c == 'a'){ printf("%s\n", this->value); this->left = search(this->left);