clear train

This commit is contained in:
Valér Jakubčo 2021-11-04 20:29:11 +01:00
parent 231059682f
commit 56ae5df2a6

View File

@ -54,12 +54,12 @@ struct car* clear_train(struct car* first, const char* target) {
while( this->next->next != NULL){
if(strcmp(this->next->value, target) == 0){
free(this->next);
this == this->next->next;
this->next = this->next->next;
return first;
}
else {
continue;
this = this->next;
}
}
return NULL;
return first;
}