title: Inputting into a char* declared earlier crashes the program while doing that into a 'just-declared' char* doesn't. Why?
body: <p>This code crashes the program</p>
  
  <pre><code>#include &lt;cstdio&gt;
  int main()
  {
      char *name1;
      char *name2 = "Mark";
      gets(name1);
      puts(name1);
      return 0;
  }
  </code></pre>
  
  <p>whereas this doesn't</p>
  
  <pre><code>#include &lt;cstdio&gt;
  int main()
  {
      char *name1 = "Mark";
      char *name2;
      gets(name2);
      puts(name2);
      return 0;
  }
  </code></pre>
  
  <p>Why ?
  I am using MinGW with Code::Blocks IDE.</p>