how to compare between two strings using recursion in C
<p>i need to compre two strings and to compare them using recursion. in the process to count the number of the differences up to two.
i tried this:</p>

<pre><code>int strcmp1(char *str1, char *str2){
int err=0;
if(strlen(str1)-strlen(str2)&gt;1 ||strlen(str1)-strlen(str2)&lt;1)
    return 0;

 if (*str1 =='\0' &amp;&amp; *str2=='\0'|| err==2)
    return err;

if (*str1!=*str2)
    err++;

return strcmp1(str1 + 1, str2 + 1);
}
</code></pre>

<p>the code i wrote returns only 0 or 1, not the amount of differences...
can you please tell me what am i doing wrong?
thx :)</p>