From 466f69ab17180334e112ee1c1b5199d4694afbfe Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Wed, 4 Nov 2020 22:53:19 +0100 Subject: [PATCH] clear --- cv5/a_train.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/cv5/a_train.c b/cv5/a_train.c index cdfe297..027fbcd 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -77,20 +77,14 @@ struct car* clear_train(struct car* first, const char* target) { prev = curr; curr = curr->next; } - prev->next = curr->next; + curr->next = prev->next; this->next = NULL; free(this); + } this = this->next; } - - int x = strcmp(this->value, target); - if(x == 0){ - free(this->next); - this->next = NULL; - return first; - } return first; }