title: Why do I get error run-time without calloc function?
body: <p>When I use <code>char*</code> to store a <code>name</code> without <code>calloc</code>, it will have a error at run-time:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  using namespace std;
  
  int main()
  {
    char* name;
    cout &lt;&lt; "What's your name? ";
    gets (name);
    cout &lt;&lt; "Hello, " &lt;&lt; name;
    return 0;
  }
  </code></pre>
  
  <p>It will be not problem when I use:</p>
  
  <blockquote>
    <p>char* name = (char *) calloc(100, sizeof(char));</p>
  </blockquote>
  
  <p>Can you tell me why? Thanks,</p>