diff --git a/cv5/a_train.c b/cv5/a_train.c index ba93a1b..57e4d94 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -62,8 +62,9 @@ struct car* clear_train(struct car* first, const char* target) { return first; } } + struct car* prev = first; - while(prev->next->next != NULL){ + while(prev->next->next->next != NULL){ int x = strcmp(first->value, target); if(x == 0){ prev = first->next; @@ -81,7 +82,7 @@ struct car* clear_train(struct car* first, const char* target) { } prev = prev->next; } - + /* if(prev->next->next == NULL) { int x = strcmp(first->value, target); if(x == 0){ @@ -96,7 +97,7 @@ struct car* clear_train(struct car* first, const char* target) { free(prev->next); prev->next = third; } - } + } */ return first; }