From 31432ec6b39b6f810d54e4b6a6b15e8798fb7ed8 Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Wed, 4 Nov 2020 13:08:34 +0100 Subject: [PATCH] clear --- cv5/a_train.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cv5/a_train.c b/cv5/a_train.c index be8f372..0ec470b 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -68,7 +68,8 @@ 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; + third->next = NULL; return first; } prev = prev->next; @@ -80,5 +81,6 @@ struct car* clear_train(struct car* first, const char* target) { return first; } + return first; }