Compare commits
2 Commits
8fb4fea3ec
...
d9c0ad3b48
Author | SHA1 | Date | |
---|---|---|---|
d9c0ad3b48 | |||
81eac89d18 |
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user