GCC Code Coverage Report


Directory: ./
File: s21_strchr.c
Date: 2025-11-01 23:04:41
Exec Total Coverage
Lines: 9 9 100.0%
Branches: 8 8 100.0%

Line Branch Exec Source
1 #include "s21_string.h"
2
3 3574 char* s21_strchr(const char* str, int c) {
4 3574 char* result = S21_NULL;
5 3574 char* p = (char*)str;
6
4/4
✓ Branch 0 taken 15904 times.
✓ Branch 1 taken 3253 times.
✓ Branch 2 taken 15583 times.
✓ Branch 3 taken 321 times.
19157 for (; *p != '\0' && result == S21_NULL; p++) {
7
2/2
✓ Branch 0 taken 411 times.
✓ Branch 1 taken 15172 times.
15583 if (*p == c) {
8 411 result = p;
9 }
10 }
11
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 3571 times.
3574 if (c == '\0') {
12 3 result = p;
13 }
14
15 3574 return result;
16 }
17