Implementation of strcmp
<p>I tried to implement <a href="http://pubs.opengroup.org/onlinepubs/009695399/functions/strcmp.html" rel="nofollow noreferrer"><code>strcmp</code></a>:</p>
<pre><code>int strCmp(char string1[], char string2[])
{
    int i = 0, flag = 0;    
    while (flag == 0) {
        if (string1[i] &gt; string2[i]) {
            flag = 1;
        } else
        if (string1[i] &lt; string2[i]) {
            flag = -1;
        } else {
            i++;
        }
    }
    return flag;
}
</code></pre>
<p>but I'm stuck with the case that the user will input the same strings, because the function works with <code>1</code> and <code>-1</code>, but it's doesn't return <code>0</code>. Can anyone help? And please without pointers!</p>