This commit is contained in:
Maryna Kravtsova 2020-11-04 22:53:19 +01:00
parent 7110825154
commit 466f69ab17

View File

@ -77,20 +77,14 @@ struct car* clear_train(struct car* first, const char* target) {
prev = curr; prev = curr;
curr = curr->next; curr = curr->next;
} }
prev->next = curr->next; curr->next = prev->next;
this->next = NULL; this->next = NULL;
free(this); free(this);
} }
this = this->next; this = this->next;
} }
int x = strcmp(this->value, target);
if(x == 0){
free(this->next);
this->next = NULL;
return first;
}
return first; return first;
} }