From d4271c33704ec5095e7081d5502865379bec3cf1 Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Thu, 5 Nov 2020 15:51:07 +0100 Subject: [PATCH] clear --- cv5/a_train.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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){