From 3f9d54d44a7194b0a2bd6c3cdf23178f9468ece2 Mon Sep 17 00:00:00 2001 From: Radovan Kofira Date: Thu, 5 Nov 2020 19:56:30 +0100 Subject: [PATCH] 15% --- cv5/a_train.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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;