clear
This commit is contained in:
parent
d4212aaf74
commit
445ea708a1
@ -63,16 +63,6 @@ struct car* clear_train(struct car* first, const char* target) {
|
||||
}
|
||||
}
|
||||
struct car* prev = first;
|
||||
int z = strcmp(prev->value, target);
|
||||
if(z == 0){
|
||||
struct car* only = prev->next;
|
||||
free(prev);
|
||||
prev = only;
|
||||
free(only);
|
||||
only = NULL;
|
||||
return first;
|
||||
|
||||
}
|
||||
while(prev->next->next != NULL){
|
||||
int x = strcmp(prev->next->value, target);
|
||||
if(x == 0){
|
||||
@ -86,7 +76,7 @@ struct car* clear_train(struct car* first, const char* target) {
|
||||
int x = strcmp(prev->next->value, target);
|
||||
if(x == 0){
|
||||
free(prev->next);
|
||||
prev->next = NULL;
|
||||
//prev->next = NULL;
|
||||
return first;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user