| Line | Branch | Exec | Source | 
|---|---|---|---|
| 1 | /* | ||
| 2 | ** EPITECH PROJECT, 2024 | ||
| 3 | ** my_count_letter | ||
| 4 | ** File description: | ||
| 5 | ** Returns the number of times the letter (c) chose is in the string (str) | ||
| 6 | */ | ||
| 7 | /** | ||
| 8 | * @file my_count_letter.c | ||
| 9 | * @brief The file containing the my_count_letter function | ||
| 10 | * @author Nicolas TORO | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include "my.h" | ||
| 14 | |||
| 15 | 1 | int my_count_letter(char const *str, char c) | |
| 16 | { | ||
| 17 | 1 | int count = 0; | |
| 18 | |||
| 19 | 2/2✓ Branch 0 taken 6 times. ✓ Branch 1 taken 1 times. | 7 | for (int index = 0; str[index] != '\0'; index++) { | 
| 20 | 2/2✓ Branch 0 taken 2 times. ✓ Branch 1 taken 4 times. | 6 | if (str[index] == c) | 
| 21 | 2 | count++; | |
| 22 | } | ||
| 23 | 1 | return count; | |
| 24 | } | ||
| 25 |