clear
This commit is contained in:
parent
a12780d4aa
commit
4c61a14372
@ -60,7 +60,7 @@ struct car* clear_train(struct car* first, const char* target) {
|
||||
}
|
||||
}
|
||||
struct car* this = first;
|
||||
if(first->next->next == NULL){
|
||||
/*if(first->next->next == NULL){
|
||||
int x = strcmp(this->next->value, target);
|
||||
if(x == 0){
|
||||
struct car* secondlast = first;
|
||||
@ -76,10 +76,18 @@ struct car* clear_train(struct car* first, const char* target) {
|
||||
}
|
||||
free(this);
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
else{
|
||||
while(this != NULL){
|
||||
while(this != NULL){
|
||||
int x =strcmp(this->value, target);
|
||||
if(x == 0){
|
||||
return NULL;
|
||||
}
|
||||
this = this->next
|
||||
}
|
||||
/*int x = strcmp(this->value, target);
|
||||
if(x == 0){
|
||||
struct car* curr = first;
|
||||
struct car* prev = NULL;
|
||||
@ -96,7 +104,7 @@ struct car* clear_train(struct car* first, const char* target) {
|
||||
prev->next = curr->next;
|
||||
free(this);
|
||||
}
|
||||
this = this->next;
|
||||
this = this->next;*/
|
||||
}
|
||||
}
|
||||
return first;
|
||||
|
Loading…
Reference in New Issue
Block a user