Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | ** EPITECH PROJECT, 2023 | ||
3 | ** my_strcmp.c | ||
4 | ** File description: | ||
5 | ** return 1, 0, -1 if s1 is bigger, equal, smaller | ||
6 | */ | ||
7 | |||
8 | #include "my.h" | ||
9 | |||
10 | 1771 | int my_strcmp(char const *s1, char const *s2) | |
11 | { | ||
12 | 1771 | int i = 0; | |
13 | |||
14 |
4/4✓ Branch 0 taken 1800 times.
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 1788 times.
✓ Branch 3 taken 12 times.
|
1864 | while (s1[i] != '\0' && s2[i] != '\0') { |
15 |
2/2✓ Branch 0 taken 1695 times.
✓ Branch 1 taken 93 times.
|
1788 | if (s1[i] != s2[i]) |
16 | 1695 | return (s1[i] - s2[i]); | |
17 | 93 | i++; | |
18 | } | ||
19 | 76 | return s1[i] - s2[i]; | |
20 | } | ||
21 |