title: Why does strcpy trigger a segmentation fault with global variables?
body: <p>So I've got some C code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  /* putting one of the "char*"s here causes a segfault */
  void main() {
    char* path = "/temp";
    char* temp;
    strcpy(temp, path);
  }
  </code></pre>
  
  <p>This compiles, runs, and behaves as it looks. However, if one or both of the character pointers is declared as global variable, strcpy results in a segmentation fault. Why does this happen? Evidently there's an error in my understanding of scope.</p>