correct cv4

This commit is contained in:
Ivan Leichenko 2024-10-17 23:02:31 +02:00
parent 8fb4fea3ec
commit 81eac89d18
2 changed files with 22 additions and 1 deletions

View File

@ -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))

View File

@ -1,4 +1,4 @@
#include "a_train.h"
#include "a_train.c"
#include <stdio.h>
#include <string.h>