This commit is contained in:
Maryna Kravtsova 2020-11-02 11:42:12 +01:00
parent cb21f01ac7
commit fdde562ecf

View File

@ -20,11 +20,10 @@ struct car* add_car(struct car* first,const char* target) {
void print_train(struct car* first) { void print_train(struct car* first) {
struct car* this = first; struct car* this = first;
/*if(first == NULL){ if(first == NULL){
exit(0); exit(0);
}*/ }
//else{ else{
if(first != NULL){
while(this != NULL){ while(this != NULL){
printf("%s\n", this->value); printf("%s\n", this->value);
this = this->next; this = this->next;
@ -38,9 +37,9 @@ void cancel_train(struct car* first) {
exit(0); exit(0);
} }
else if(first->next == NULL){ else if(first->next == NULL){
this = first; //this = first;
first = first->next; //first = first->next;
free(this); free(first);
first = NULL; first = NULL;
} }
else{ else{