diff --git a/cv5/a_train.c b/cv5/a_train.c index 3e5b1f2..baf72b4 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -30,16 +30,6 @@ void print_train(struct car* first) { for(struct car* this = first; this != NULL; this = this->next){ printf("%s\n", this->value); } - /*struct car* this = first; - if(first == NULL){ - exit(0); - } - else{ - while(this != NULL){ - printf("%s\n", this->value); - this = this->next; - } - }*/ } void cancel_train(struct car* first) { @@ -52,10 +42,7 @@ void cancel_train(struct car* first) { } else if(first->next == NULL){ free(first); - // cancel_train(first->next); } - //free(first); - } @@ -74,11 +61,11 @@ struct car* clear_train(struct car* first, const char* target) { } else{ struct car* this = first; - while(this != NULL){ + while(first != NULL){ int x = strcmp(this->value, target); if(x == 0){ struct car* temp = this->next; - this->value = temp->value; + strcpy(this->value,temp->value); free(temp); return 0; }