From 194849ce29bcc473686f1c6cf8cc19d8b44fff11 Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Tue, 3 Nov 2020 11:05:36 +0100 Subject: [PATCH] clear --- cv5/a_train.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cv5/a_train.c b/cv5/a_train.c index 6f86beb..40281eb 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -78,10 +78,11 @@ struct car* clear_train(struct car* first, const char* target) { while(this != NULL){ int x = strcmp(this->value, target); if(x == 0){ - struct car *third = this->next; + this->value = this->next->value; + struct car* third = this->next; this->next = third->next; free(third); - return first; + return 0; } this = this->next; }