diff --git a/cv5/a_train.c b/cv5/a_train.c index 75396af..c313084 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -17,9 +17,9 @@ struct car* add_car(struct car* first,const char* target) { struct car* temp=first; int length=0; while(temp!=NULL){ - temp=temp->next; - length++; - printf("%d",length); + if(temp->next!=NULL) + temp=temp->next; + length++; } strcpy(newcar->value, target);