| 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 | * @file my_strncat.c | ||
| 10 | * @brief The file containing the my_strncat function | ||
| 11 | * @author Nicolas TORO | ||
| 12 | */ | ||
| 13 | |||
| 14 | #include "my.h" | ||
| 15 | |||
| 16 | 3 | char *my_strncat(char *dest, char const *src, int n) | |
| 17 | { | ||
| 18 | 3 | int len_dest = my_strlen(dest); | |
| 19 | 3 | int i = 0; | |
| 20 | |||
| 21 | 4/4✓ Branch 0 taken 2 times. ✓ Branch 1 taken 1 times. ✓ Branch 2 taken 1 times. ✓ Branch 3 taken 1 times. | 3 | if (dest == NULL || src == NULL) | 
| 22 | 2 | return NULL; | |
| 23 | 2/2✓ Branch 0 taken 2 times. ✓ Branch 1 taken 1 times. | 3 | for (i = 0; i < n; i++) | 
| 24 | 2 | dest[len_dest + i] = src[i]; | |
| 25 | 1 | dest[len_dest + i] = '\0'; | |
| 26 | 1 | return dest; | |
| 27 | } | ||
| 28 |