Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | ** EPITECH PROJECT, 2024 | ||
3 | ** template | ||
4 | ** File description: | ||
5 | ** The my_strdup_word_array.c | ||
6 | */ | ||
7 | |||
8 | #include "mymemory.h" | ||
9 | |||
10 | 3 | char **my_malloc_strdup_word_array(char **array) | |
11 | { | ||
12 | char **new_array; | ||
13 | 3 | int i = 0; | |
14 | |||
15 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
|
3 | if (array == NULL) |
16 | 1 | return (NULL); | |
17 | 2 | new_array = my_malloc(sizeof(char *) * | |
18 | 2 | (my_array_len((void **)array) + 1), 1); | |
19 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
|
4 | for (; array[i] != NULL; i++) |
20 | 2 | new_array[i] = my_malloc_strdup(array[i]); | |
21 | 2 | new_array[i] = NULL; | |
22 | 2 | return new_array; | |
23 | } | ||
24 |