Why am I unable to use a variable when using the map() function?

Viewed 58
int main()
{
    unsigned int num = 2;
    string map[num][3] = {{"c","d","s"}, {"A", "u", "p"}};
    for(int y = 0; y < 2; y++)
            {
                for(int x = 0; x < 3; x++)
                {
                    cout << map[y][x];
                }

                cout << endl;
            }
}

I'm using Xcode and it gives me an error saying "Variable-sized object may not be initialized". Am I simply doing it wrong or is the map function unable to take in variables as arguments?

1 Answers
Related