This commit is contained in:
Maryna Kravtsova 2020-11-03 21:12:51 +01:00
parent a12780d4aa
commit 4c61a14372

View File

@ -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;