Hey,

How is the strcmp(char*, char*) implemented?
I need to implement it myself for my Comp Science class, and this is what I got:
PHP Code:
int strcmp(const chars1, const chars2)
{
    const 
charp1 s1 1;
    const 
charp2 s2 1;

    while (*++
p2 == *++p1)
        if (!*
p2 || !*p1)
            break;

    if (*
p2 > *p1)
        return (-
1);
    else if (*
p1 > *p2)
        return (
1);

    return (
0);

But it looks too long and clumsy for such a simple function.


Thanks.