diff --git a/cv4/a_train.c b/cv4/a_train.c index 6c2afae..bfc56f4 100644 --- a/cv4/a_train.c +++ b/cv4/a_train.c @@ -76,6 +76,27 @@ struct car* clear_train(struct car* first, const char* target) } } struct car* prev = first; + + if(prev->next->next == NULL) + { + if(!strcmp(prev->value, target)) + { + struct car* second = prev->next; + free(prev); + first = second; + return first; + } + else if(!strcmp(prev->next->value, target)) + { + free(prev->next); + return first; + } + else + { + return first; + } + } + while (prev->next->next != NULL) { if(strcmp(prev->value, target)) diff --git a/cv4/main.c b/cv4/main.c index ee71136..2b056f6 100644 --- a/cv4/main.c +++ b/cv4/main.c @@ -1,4 +1,4 @@ -#include "a_train.h" +#include "a_train.c" #include #include