From 02f66e152ae2c5f0defba15b44d1d09b43cd7ba2 Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Thu, 5 Nov 2020 16:04:41 +0100 Subject: [PATCH] clear --- cv5/a_train.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cv5/a_train.c b/cv5/a_train.c index ba93a1b..57e4d94 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -62,8 +62,9 @@ struct car* clear_train(struct car* first, const char* target) { return first; } } + struct car* prev = first; - while(prev->next->next != NULL){ + while(prev->next->next->next != NULL){ int x = strcmp(first->value, target); if(x == 0){ prev = first->next; @@ -81,7 +82,7 @@ struct car* clear_train(struct car* first, const char* target) { } prev = prev->next; } - + /* if(prev->next->next == NULL) { int x = strcmp(first->value, target); if(x == 0){ @@ -96,7 +97,7 @@ struct car* clear_train(struct car* first, const char* target) { free(prev->next); prev->next = third; } - } + } */ return first; }