| Directory: | ./ |
|---|---|
| File: | s21_strncmp.c |
| Date: | 2025-11-01 23:04:41 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 5 | 5 | 100.0% |
| Branches: | 4 | 4 | 100.0% |
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "s21_string.h" | ||
| 2 | |||
| 3 | 5 | int s21_strncmp(const char *str1, const char *str2, s21_size_t n) { | |
| 4 | 5 | int dif = 0; | |
| 5 |
4/4✓ Branch 0 taken 12 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 11 times.
✓ Branch 3 taken 1 times.
|
16 | for (s21_size_t i = 0; i < n && dif == 0; i++) { |
| 6 | 11 | dif = str1[i] - str2[i]; | |
| 7 | } | ||
| 8 | |||
| 9 | 5 | return dif; | |
| 10 | } | ||
| 11 |