From 81c09c06b7c8a7d1c56a9b3ed22d66877918e5db Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Tue, 3 Nov 2020 21:23:12 +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 dc9d48a..5fb8b74 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -82,9 +82,10 @@ struct car* clear_train(struct car* first, const char* target) { struct car* this = first; while(this != NULL){ while(this != NULL){ - int x =strcmp(this->value, target); + int x = strcmp(this->value, target); if(x == 0){ - return NULL; + free(this); + return first; } this = this->next; }