Initializacia

This commit is contained in:
Kozar 2024-10-20 12:58:05 +00:00
parent 6448cb0e4d
commit 2e25765e5d

View File

@ -5,18 +5,20 @@
struct car* add_car(struct car* first, const char* target) {
struct car* last = first;
struct car* newcar* = calloc(1, sizeof(struct car));
struct car* newcar = calloc(1, sizeof(struct car));
strcpy(newcar->value, target);
if (last != NULL) {
struct car* current = last;
while (current->next != NULL) {
current = current->next
current = current->next;
}
current->next = newcar;
} else {
last = newcar;
return last;
}
return first;
}