Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | ** EPITECH PROJECT, 2023 | ||
3 | ** my_array_len | ||
4 | ** File description: | ||
5 | ** Returns the lengths of an array (array) which finish with a NULL value | ||
6 | */ | ||
7 | /** | ||
8 | * @file my_array_len.c | ||
9 | * @brief The file containing the my_array_len function | ||
10 | * @author Nicolas TORO | ||
11 | */ | ||
12 | |||
13 | #include "my.h" | ||
14 | |||
15 | 5 | int my_array_len(void **array) | |
16 | { | ||
17 | 5 | int len = 0; | |
18 | |||
19 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 4 times.
|
5 | if (array == NULL) |
20 | 1 | return 0; | |
21 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 4 times.
|
14 | while (array[len] != NULL) |
22 | 10 | len = len + 1; | |
23 | 4 | return len; | |
24 | } | ||
25 |