This commit is contained in:
Maryna Kravtsova 2020-11-02 16:47:32 +01:00
parent eaff9d7eb1
commit 8e6497b6e8

View File

@ -14,9 +14,11 @@ struct car* add_car(struct car* first,const char* target) {
if(first == NULL){
strcpy(newcar->value, target);
newcar->next = NULL;
return newcar;
}
strcpy(newcar->value,target);
strcpy(newcar->value,target);
newcar->next = NULL;
struct car *this = first;
while(this->next != NULL){
this = this->next;
@ -49,7 +51,7 @@ void cancel_train(struct car* first) {
cancel_train(first->next);
first->next = NULL;
}
if(first->next == NULL){
else if(first->next == NULL){
free(first);
// cancel_train(first->next);
}
@ -60,6 +62,9 @@ void cancel_train(struct car* first) {
struct car* clear_train(struct car* first, const char* target) {
if(first == NULL){
return 0;
}
struct car* this = first;
while(this != NULL){
if(this->value == target){