This commit is contained in:
Maryna Kravtsova 2020-11-03 22:07:29 +01:00
parent d623d8b2ba
commit 3a8404ccf4

View File

@ -80,18 +80,8 @@ struct car* clear_train(struct car* first, const char* target) {
else{ else{
struct car* this = first; struct car* this = first;
while(this!= NULL){ while(this->next!= NULL){
//while(this != NULL){ int x = strcmp(this->value, target);
int x = strcmp(this->next->value, target);
if(x == 0){
struct car* temp = this->next->next;
this->next = NULL;
this->next = temp;
return this;
}
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;
@ -108,7 +98,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;