How can i copy to string literal in C : <pre><code>char temp1[4] = "abc";
char *temp2 = "123";
strcpy(temp1,temp2);
</code></pre>

<p>if I want to copy a string literal to an array, it works well, but if I do it in the opposite way, I get an error:</p>

<pre><code>char temp1[4] = "abc";
char *temp2 = "123";
strcpy(temp2,temp1);
</code></pre>

<p>The feedback from compiler is "Segmentation fault".</p>

<p>So what's the differences? Is there anyway to copy a string to a string literal?</p>

<p>Thx. </p>
