Trouble about assign char pointer in C <p>I have a simple C program about assign char pointer and malloc like this</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; int main() { char str[] = "0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789"; char* str1 = malloc(sizeof(char*)); strcpy(str1, str); printf("%s\n\n", str1); char* str2 = malloc(sizeof(char*)); str2 = str1; printf("%s\n", str2); return 0; } </code></pre> <p>And the result is:</p> <pre><code>0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 01! </code></pre> <p>So why the str2 just gets 25 characters from str1? And where is the "!" (in the end of str2) come from?</p> <p>Could you help me? Thanks!</p>