This commit is contained in:
Maryna Kravtsova 2020-11-05 16:04:41 +01:00
parent 2230d9d16e
commit 02f66e152a

View File

@ -62,8 +62,9 @@ struct car* clear_train(struct car* first, const char* target) {
return first; return first;
} }
} }
struct car* prev = first; struct car* prev = first;
while(prev->next->next != NULL){ while(prev->next->next->next != NULL){
int x = strcmp(first->value, target); int x = strcmp(first->value, target);
if(x == 0){ if(x == 0){
prev = first->next; prev = first->next;
@ -81,7 +82,7 @@ struct car* clear_train(struct car* first, const char* target) {
} }
prev = prev->next; prev = prev->next;
} }
/*
if(prev->next->next == NULL) { if(prev->next->next == NULL) {
int x = strcmp(first->value, target); int x = strcmp(first->value, target);
if(x == 0){ if(x == 0){
@ -96,7 +97,7 @@ struct car* clear_train(struct car* first, const char* target) {
free(prev->next); free(prev->next);
prev->next = third; prev->next = third;
} }
} } */
return first; return first;
} }