From 0c8f1acd3122592908fb876a81d2f05a76e469c7 Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Wed, 4 Nov 2020 13:10:12 +0100 Subject: [PATCH] clear --- cv5/a_train.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cv5/a_train.c b/cv5/a_train.c index 0ec470b..a7c8791 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -68,8 +68,7 @@ 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; - third->next = NULL; + prev->next = third; return first; } prev = prev->next; @@ -77,7 +76,7 @@ struct car* clear_train(struct car* first, const char* target) { int x = strcmp(prev->next->value, target); if(x == 0){ free(prev->next); - prev->next = NULL; + prev->next->next = NULL; return first; }