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?

```
struct character
{
    char *name;
};

int main()
{
    character player;
    player.name = new char[10];
    player.name = "Mario";
    cout<<player.name<<endl;
    delete player.name;
    return 0;
}

```

Thanks