correct cv4
This commit is contained in:
parent
8fb4fea3ec
commit
81eac89d18
@ -76,6 +76,27 @@ struct car* clear_train(struct car* first, const char* target)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
struct car* prev = first;
|
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)
|
while (prev->next->next != NULL)
|
||||||
{
|
{
|
||||||
if(strcmp(prev->value, target))
|
if(strcmp(prev->value, target))
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "a_train.h"
|
#include "a_train.c"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user