From 1cc637bbf4f92133bf4668fcba8c32b211009635 Mon Sep 17 00:00:00 2001 From: vj586da Date: Fri, 5 Nov 2021 08:21:26 +0100 Subject: [PATCH] test --- cv4/a_train.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cv4/a_train.c b/cv4/a_train.c index 78af766..0961887 100755 --- a/cv4/a_train.c +++ b/cv4/a_train.c @@ -53,11 +53,8 @@ struct car* clear_train(struct car* first, const char* target) { } if(this->next->next == NULL){ if(strcmp(this->value, target) == 0){ - //strcpy(this->value,this->next->value); - //this->next=NULL; struct car* tmp = this->next; free(this); - //free(this->next); return tmp; }else if(strcmp(this->next->value, target) == 0){ free(this->next); @@ -80,6 +77,10 @@ struct car* clear_train(struct car* first, const char* target) { free(this->next); this->next=NULL; return this; + }else if(strcmp(this->next->next->value, target) == 0){ + free(this->next->next); + this->next=NULL; + return this; } return first; }