This commit is contained in:
Maryna Kravtsova 2020-11-05 15:46:53 +01:00
parent 4050454880
commit 468b37d1be

View File

@ -72,13 +72,12 @@ struct car* clear_train(struct car* first, const char* target) {
} }
x = strcmp(prev->next->value, target); x = strcmp(prev->next->value, target);
// if(x == 0){ if(x == 0){
/* if(first->next->next == NULL) { struct car* third = prev->next->next;
//struct car* tmp = prev->next; free(prev->next);
free(prev->next); prev->next = third;
prev->next = NULL;
}*/ }
//}
prev = prev->next; prev = prev->next;
} }
if(prev->next->next == NULL) { if(prev->next->next == NULL) {
@ -89,6 +88,13 @@ struct car* clear_train(struct car* first, const char* target) {
return prev; return prev;
} }
x = strcmp(prev->next->value, target);
if(x == 0){
struct car* third = prev->next->next;
free(prev->next);
prev->next = third;
}
//free(prev->next); //free(prev->next);
//prev->next = NULL; //prev->next = NULL;
} }