Rebuilding an array

I am working on a project that starts by building an array. I want to have the option later to rebuild and change that array but I'm getting runtime errors that I dont understand.
Here is the code snippet.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
player[] is initialized and used up here.
...
case 1: //New players
{
    cout << "How many players are there?";
    cin >> PLAYERS;

    delete[] player;
    character player[PLAYERS];

    for (int i = 0; i < PLAYERS; i++)
    {
        cout << "\nPlayer " << i+1 << ":";
        player[i].create_char();
    };
    break;
};
...
player[] is used some more down here.
You can only delete something that you created with new.
1
2
character* player = new character[PLAYERS];
delete player;
Thank you, problem solved.
Topic archived. No new replies allowed.