current -> tail in zad2
This commit is contained in:
parent
f2f78e0cfa
commit
685d4db676
1 changed files with 5 additions and 5 deletions
|
@ -28,13 +28,13 @@ void linked_list_insert(LinkedList *l, void *value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node *current = l->head;
|
Node *tail = l->head;
|
||||||
while (current->next != l->head) {
|
while (tail->next != l->head) {
|
||||||
current = current->next;
|
tail = tail->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
current->next = node_new(value, l->element_size);
|
tail->next = node_new(value, l->element_size);
|
||||||
current->next->next = l->head;
|
tail->next->next = l->head;
|
||||||
l->length += 1;
|
l->length += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue