blob: 1115dd0521a88846d751aeae1fe1b4f33dac6475 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
int min(const size_t first,const size_t second)
{
return (first < second ? first : second);
}
int my_strcmp(const char* str1, const char* str2)
{
size_t str1Length = my_strlen(str1);
size_t str2Length = my_strlen(str2);
size_t smallerLength = min(str1Length, str2Length);
for (size_t i = NULL; i < smallerLength; i++)
{
if (str1[i] - str2[i] != NULL)
return str1[i] - str2[i];
}
return str1Length - str2Length;
}
|