Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | ** EPITECH PROJECT, 2023 | ||
3 | ** my_concat_list | ||
4 | ** File description: | ||
5 | ** Concatenates two linked lists | ||
6 | */ | ||
7 | /** | ||
8 | * @file my_concat_list.c | ||
9 | * @brief The file containing the my_concat_list function | ||
10 | * @author Nicolas TORO | ||
11 | */ | ||
12 | |||
13 | #include "mylist.h" | ||
14 | |||
15 | 2 | void my_concat_list(node_t **begin1, node_t *begin2) | |
16 | { | ||
17 | 2 | node_t *tmp = *begin1; | |
18 | |||
19 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
|
2 | if (*begin1 == NULL) { |
20 | 1 | *begin1 = begin2; | |
21 | 1 | return; | |
22 | } | ||
23 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 times.
|
6 | for (; tmp->next != NULL; tmp = tmp->next); |
24 | 1 | tmp->next = begin2; | |
25 | 1 | begin2->prev = tmp; | |
26 | } | ||
27 |