| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | ** EPITECH PROJECT, 2023 | ||
| 3 | ** day08 | ||
| 4 | ** File description: | ||
| 5 | ** Task02 | ||
| 6 | */ | ||
| 7 | |||
| 8 | #include <stdlib.h> | ||
| 9 | #include "my.h" | ||
| 10 | |||
| 11 | 1 | char *my_concat_params(int argc, char **argv) | |
| 12 | { | ||
| 13 | char *result; | ||
| 14 | 1 | int len_result = 0; | |
| 15 | 1 | int j = 0; | |
| 16 | |||
| 17 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
|
5 | for (int i = 0; i < argc; i++) { |
| 18 | 4 | len_result = len_result + my_strlen(argv[i]); | |
| 19 | } | ||
| 20 | 1 | result = malloc(sizeof(char) * (len_result + argc)); | |
| 21 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
|
5 | for (j = 0; j < argc; j++) { |
| 22 | 4 | result = my_strcat(result, argv[j]); | |
| 23 | 4 | result = my_strcat(result, "\n"); | |
| 24 | } | ||
| 25 | 1 | result[len_result + argc] = '\0'; | |
| 26 | 1 | return result; | |
| 27 | } | ||
| 28 |