From 76864bd125c05da2f11744ed79a1e6d050aceeea Mon Sep 17 00:00:00 2001 From: Yurii Yakovenko Date: Wed, 23 Oct 2024 19:55:03 +0000 Subject: [PATCH] Update cv4/a_train.c --- cv4/a_train.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cv4/a_train.c b/cv4/a_train.c index 9b2a408..a3e46e1 100644 --- a/cv4/a_train.c +++ b/cv4/a_train.c @@ -1,11 +1,12 @@ #include #include"a_train.h" -/////@ + struct car* add_car(struct car* first,const char* target) { + struct car* ret = first; struct car* nc=(struct car*) malloc(sizeof(struct car)); strcpy(nc->value, target); nc->next=NULL; @@ -17,7 +18,7 @@ struct car* add_car(struct car* first,const char* target) first=first->next; } first->next=nc; - return first; + return ret; } first=nc;