Directory: | ./ |
---|---|
File: | s21_memcmp.c |
Date: | 2025-05-31 00:37:53 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 7 | 7 | 100.0% |
Branches: | 4 | 4 | 100.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | #include "s21_string.h" | ||
2 | |||
3 | 5 | int s21_memcmp(const void *str1, const void *str2, s21_size_t n){ | |
4 | 5 | unsigned char *s1 = (unsigned char*)str1; | |
5 | 5 | unsigned char *s2 = (unsigned char*)str2; | |
6 | |||
7 | 5 | int dif = 0; | |
8 |
4/4✓ Branch 0 taken 20 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 2 times.
|
23 | for(s21_size_t i = 0; i < n && dif == 0; i++){ |
9 | 18 | dif = s1[i] - s2[i]; | |
10 | } | ||
11 | |||
12 | 5 | return dif; | |
13 | } | ||
14 |