title: Core dump when using pointers
body: <p>I am writing a simple code using structures in C++, but on compilation with g++, I am getting core dumped error. If I am using cin to input "Mario" in player.name below, no error is reported. Can anyone please explain what is going wrong?</p>
  
  <pre><code>struct character
  {
      char *name;
  };
  
  int main()
  {
      character player;
      player.name = new char[10];
      player.name = "Mario";
      cout&lt;&lt;player.name&lt;&lt;endl;
      delete player.name;
      return 0;
  }
  </code></pre>
  
  <p>Thanks</p>