This commit is contained in:
Maryna Kravtsova 2020-11-03 21:49:22 +01:00
parent 535859a615
commit a8b4648778

View File

@ -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;
//}