| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | ** EPITECH PROJECT, 2023 | ||
| 3 | ** my_strncat | ||
| 4 | ** File description: | ||
| 5 | ** Concatenates a string (dest) with another string (src) | ||
| 6 | ** with a defined size (n) and returns the destination string (dest) | ||
| 7 | */ | ||
| 8 | |||
| 9 | #include "my.h" | ||
| 10 | |||
| 11 | 1 | char *my_strncat(char *dest, char const *src, int n) | |
| 12 | { | ||
| 13 | 1 | int len_dest = my_strlen(dest); | |
| 14 | 1 | int len_src = n; | |
| 15 | 1 | int i = 0; | |
| 16 | |||
| 17 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
|
3 | for (i = 0; i < len_src; i++) { |
| 18 | 2 | dest[len_dest + i] = src[i]; | |
| 19 | } | ||
| 20 | 1 | dest[len_dest + i] = '\0'; | |
| 21 | 1 | return dest; | |
| 22 | } | ||
| 23 |