title: C: copy a char *pointer to another
body: <p>i have some trouble with a simple copy function:</p>
  
  <pre><code>void string_copy(char *from, char *to) {
  
      while ((*to++ = *from++) != '\0')
          ;
  }
  </code></pre>
  
  <p>It takes two pointers to strings as parameters, it looks ok but when i try it i have this error:</p>
  
  <pre><code>Segmentation fault: 11
  </code></pre>
  
  <p>This is the complete code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  void string_copy(char *from, char *to);
  
  int main() {
      char *from = "Hallo world!";
      char *to;
      string_copy(from,to);
      return 0;
  }
  </code></pre>
  
  <p>Thank you all</p>