diff --git a/cv5/a_train.c b/cv5/a_train.c index 5521526..5042afb 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -16,10 +16,12 @@ struct car* add_car(struct car* first,const char* target) { struct car* newcar = calloc(1,sizeof(struct car)); struct car* this=first; int length=0; - while(this!=NULL){ + if(this==NULL){ + return NULL; + } + else(this->!=NULL){ this=this->next; this->next = newcar; - length++; } strcpy(newcar->value, target); return NULL;