GCC Code Coverage Report


Directory: ./
File: lib/my/my_count_letter.c
Date: 2024-06-05 00:36:48
Exec Total Coverage
Lines: 6 6 100.0%
Functions: 1 1 100.0%
Branches: 4 4 100.0%

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 67 int my_count_letter(char const *str, char c)
16 {
17 67 int count = 0;
18
19
2/2
✓ Branch 0 taken 883 times.
✓ Branch 1 taken 67 times.
950 for (int index = 0; str[index] != '\0'; index++) {
20
2/2
✓ Branch 0 taken 59 times.
✓ Branch 1 taken 824 times.
883 if (str[index] == c)
21 59 count++;
22 }
23 67 return count;
24 }
25