stack overflow c copystring with pointers : <p>I'm writing a recursive copystring function in c and I'm receiving a write access violation. The funcion doesn't terminate when the function reaches the final letter in the string.</p>

<p>Here's the code:</p>

<pre><code>#include &lt;stdio.h&gt;

void copy(char*, char*, int);

int main()
{
    char str1[10] = { 'H', 'e', ' j',' h','e', 'j' };
    char str2[10] = { '/0' };

    copy(str1, str2, 0);
    printf(str2);
    getchar();
    return 0;
}

void copy(char* str1, char* str2, int index) {
    while (str1[index] != '/0') {
        str2[index] = str1[index];
        index++;
        copy(str1, str2, index);
    }
    return;
}
</code></pre>
