This commit is contained in:
Radovan Kofira 2020-11-05 19:56:30 +01:00
parent e70abbc8cd
commit 3f9d54d44a

View File

@ -16,10 +16,12 @@ struct car* add_car(struct car* first,const char* target) {
struct car* newcar = calloc(1,sizeof(struct car)); struct car* newcar = calloc(1,sizeof(struct car));
struct car* this=first; struct car* this=first;
int length=0; int length=0;
while(this!=NULL){ if(this==NULL){
return NULL;
}
else(this->!=NULL){
this=this->next; this=this->next;
this->next = newcar; this->next = newcar;
length++;
} }
strcpy(newcar->value, target); strcpy(newcar->value, target);
return NULL; return NULL;