buffer
This commit is contained in:
		
							parent
							
								
									83f87f5e94
								
							
						
					
					
						commit
						d267e4d1c0
					
				@ -74,10 +74,10 @@ struct tree* find_minimum(struct tree *root){
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
struct tree* destroy_tree(struct tree* root){
 | 
			
		||||
void tree* destroy_tree(struct tree* root){
 | 
			
		||||
    if(root == NULL) return;
 | 
			
		||||
     
 | 
			
		||||
    if(root->left == NULL && root->right == NULL){
 | 
			
		||||
    /*if(root->left == NULL && root->right == NULL){
 | 
			
		||||
        free(root);
 | 
			
		||||
        return NULL;
 | 
			
		||||
    }
 | 
			
		||||
@ -95,9 +95,9 @@ struct tree* destroy_tree(struct tree* root){
 | 
			
		||||
        struct tree* this = find_minimum(root->left);
 | 
			
		||||
        strcpy(root->value, this->value);
 | 
			
		||||
        root->right = destroy_tree(root->right);
 | 
			
		||||
    }
 | 
			
		||||
    root->left = destroy_tree(root->left);
 | 
			
		||||
    root->right = destroy_tree(root->right);   
 | 
			
		||||
    }*/
 | 
			
		||||
    destroy_tree(root->left);
 | 
			
		||||
    destroy_tree(root->right);   
 | 
			
		||||
    free(root);
 | 
			
		||||
    root = NULL;
 | 
			
		||||
}
 | 
			
		||||
@ -142,7 +142,7 @@ int main(){
 | 
			
		||||
    printf("Odpovedajte 'a' pre prvu moznost alebo 'n' pre druhu moznost.\n");
 | 
			
		||||
    printf("%s\n", tree->value);   
 | 
			
		||||
    tree = search(tree);   
 | 
			
		||||
    tree = destroy_tree(tree);
 | 
			
		||||
    destroy_tree(tree);
 | 
			
		||||
    printf("Koniec\n");     
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user