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