strcmp的实现

int compar(char *as1, char *as2)
{
    char *s1, *s2;
 
    s1 = as1;
    s2 = as2;
    while (*s1++ ==  *s2)
    {
        if (*s2++ == 0)
        return(0);
    }
    return (*--s1 - *s2);
}


你可能感兴趣的:(strcmp)