From 460920648d38f2f21e75c292962f5ec9e164a508 Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Wed, 4 Nov 2020 11:11:22 +0100 Subject: [PATCH] clear --- cv5/a_train.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cv5/a_train.c b/cv5/a_train.c index cf81c20..7b0cdd1 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -63,6 +63,14 @@ 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; + return first; + + } while(prev->next->next != NULL){ int x = strcmp(prev->next->value, target); if(x == 0){