From 445ea708a1b94a8a4e335a9ecd59f5a5d3abafde Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Wed, 4 Nov 2020 13:02:14 +0100 Subject: [PATCH] clear --- cv5/a_train.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/cv5/a_train.c b/cv5/a_train.c index c790802..9e76076 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -63,16 +63,6 @@ struct car* clear_train(struct car* first, const char* target) { } } struct car* prev = first; - int z = strcmp(prev->value, target); - if(z == 0){ - struct car* only = prev->next; - free(prev); - prev = only; - free(only); - only = NULL; - return first; - - } while(prev->next->next != NULL){ int x = strcmp(prev->next->value, target); if(x == 0){ @@ -86,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 = NULL; return first; }