This commit is contained in:
Ivan Leichenko 2024-10-18 00:10:53 +02:00
parent 090dc461f3
commit a56eaf1028

View File

@ -104,6 +104,13 @@ struct car* clear_train(struct car* first, const char* target)
while (prev->next->next != NULL) while (prev->next->next != NULL)
{ {
if(!strcmp(prev->value, target)) if(!strcmp(prev->value, target))
{
struct car* second = prev->next;
free(prev);
first = second;
return first;
}
else if(!strcmp(prev->next->value, target))
{ {
struct car* third = prev->next->next; struct car* third = prev->next->next;
free(prev->next); free(prev->next);