Concatenate strings recursively in C
<p>I need help to concatenate strings using recursion in C.</p>

<p><strong>I have 2 strings in input, <em>src</em> and <em>dest</em>, and I need to concatenate recursively <em>src</em> to <em>dest</em>, and store the concatenated string in <em>dest</em>.</strong></p>

<p>e.g. if <code>src="house"</code> and <code>dest="clock"</code> , the output should be <code>"chlooucske"</code>.</p>

<p>EDIT: This is my code:</p>

<pre><code>char* str_concatenate(char dest[], char src[], int index){
    char temp[256]; // temporaty variable
    temp[index]=src[index]; //should copy each letter from src to temp
    temp[index+1]=dest[index]; //should copy each letter from dest to temp
    dest[index]=temp[index]; //should store the concatenated string into dest
    if (src[index]=='\0'){ //base case
        return dest;
    }
    else
        return str_concatenate(dest,src,index+1);
}

int main(){ //test
        char dest[]="house";
        char src[]="clock";

        char* ris=str_concatenate(dest,src,0);

        printf("dest= %s\n", ris); //should print "chlooucske" 
    return 0;
    }
</code></pre>

<p>However it copies the entire word from <em>src</em> to <em>dest</em> and prints it, it does not concatenate letters.</p>