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;
|
struct car* this = first;
|
||||||
if(first->next->next == NULL){
|
/*if(first->next->next == NULL){
|
||||||
int x = strcmp(this->next->value, target);
|
int x = strcmp(this->next->value, target);
|
||||||
if(x == 0){
|
if(x == 0){
|
||||||
struct car* secondlast = first;
|
struct car* secondlast = first;
|
||||||
@ -76,10 +76,18 @@ struct car* clear_train(struct car* first, const char* target) {
|
|||||||
}
|
}
|
||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
|
|
||||||
else{
|
else{
|
||||||
while(this != NULL){
|
while(this != NULL){
|
||||||
int x = strcmp(this->value, target);
|
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){
|
if(x == 0){
|
||||||
struct car* curr = first;
|
struct car* curr = first;
|
||||||
struct car* prev = NULL;
|
struct car* prev = NULL;
|
||||||
@ -96,7 +104,7 @@ struct car* clear_train(struct car* first, const char* target) {
|
|||||||
prev->next = curr->next;
|
prev->next = curr->next;
|
||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
this = this->next;
|
this = this->next;*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return first;
|
return first;
|
||||||
|
Loading…
Reference in New Issue
Block a user