diff --git a/cv5/a_train.c b/cv5/a_train.c index d8fc8bc..5415679 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -80,16 +80,14 @@ struct car* clear_train(struct car* first, const char* target) { else{ struct car* this = first; - while(this != NULL){ + while(this->next != NULL){ //while(this != NULL){ - int x = strcmp(this->value, target); + int x = strcmp(this->next->value, target); if(x == 0){ - first = this->next; - free(this); + struct car* temp = this->next->next; this->next = NULL; - //free(this->next); - - return first; + this->next = temp; + return this; } this = this->next; //}