Изменил(а) на 'cv4/a_train.c'
This commit is contained in:
parent
e08472fa25
commit
43082a4100
@ -7,9 +7,16 @@ struct car* add_car(struct car* first, const char* target){
|
||||
if(!strcmp(target, ""))
|
||||
return NULL;
|
||||
|
||||
if(!first){
|
||||
first = (struct car*)calloc(1, sizeof(struct car));
|
||||
strcpy(first->value, target);
|
||||
first->next = NULL;
|
||||
return first;
|
||||
}
|
||||
|
||||
struct car* temp = first;
|
||||
|
||||
while(temp != NULL)
|
||||
while(temp->next != NULL)
|
||||
temp = temp->next;
|
||||
|
||||
temp->next = (struct car*)calloc(1, sizeof(struct car));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user