This commit is contained in:
Maryna Kravtsova 2020-11-03 11:09:50 +01:00
parent 194849ce29
commit b6d8ebbf3c

View File

@ -1,5 +1,4 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -78,10 +77,9 @@ struct car* clear_train(struct car* first, const char* target) {
while(this != NULL){
int x = strcmp(this->value, target);
if(x == 0){
this->value = this->next->value;
struct car* third = this->next;
this->next = third->next;
free(third);
struct car* temp = this->next;
this->value = temp->value;
free(temp);
return 0;
}
this = this->next;