Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | ** EPITECH PROJECT, 2023 | ||
3 | ** my_list_size_circled | ||
4 | ** File description: | ||
5 | ** Returns the size of a circular linked list | ||
6 | */ | ||
7 | /** | ||
8 | * @file my_list_size_circled.c | ||
9 | * @brief The file containing the my_list_siz_circled function | ||
10 | * @author Gianni TUERO | ||
11 | */ | ||
12 | |||
13 | #include "mylist.h" | ||
14 | |||
15 | 1092 | int my_list_size_circled(node_t const *begin) | |
16 | { | ||
17 | 1092 | int nb = 0; | |
18 | |||
19 |
2/2✓ Branch 0 taken 7242 times.
✓ Branch 1 taken 1092 times.
|
8334 | for (node_t const *tmp = begin; tmp != NULL; tmp = tmp->next) { |
20 | 7242 | nb++; | |
21 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7242 times.
|
7242 | if (tmp->next == begin) |
22 | ✗ | break; | |
23 | } | ||
24 | 1092 | return nb; | |
25 | } | ||
26 |