diff --git a/cv5/a_train.c b/cv5/a_train.c index 7a9aa9a..ce28c00 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -75,11 +75,15 @@ struct car* clear_train(struct car* first, const char* target) { if(x == 0){ struct car* third = prev->next->next; free(prev->next); - prev->next = third; + prev->next = third; + return first; } prev = prev->next; - } + } + + + if(prev->next->next == NULL) { int x = strcmp(first->value, target); if(x == 0){