S
Steven
Hello, everyone!
I find a version of strcpy(), I don't know why it return the unsigned
char value.
Can I change it into return *s1-*s2?
int strcmp(const char *s1, const char *s2)
{
while (*s1 == *s2)
{
if (*s1 == 0)
return 0;
s1++;
s2++;
}
return *(unsigned const char *)s1 - *(unsigned const char *)(s2);
}
I find a version of strcpy(), I don't know why it return the unsigned
char value.
Can I change it into return *s1-*s2?
int strcmp(const char *s1, const char *s2)
{
while (*s1 == *s2)
{
if (*s1 == 0)
return 0;
s1++;
s2++;
}
return *(unsigned const char *)s1 - *(unsigned const char *)(s2);
}