0

I'm struggling with creating a large empty 2D array of strings (120000x7).

I created empty matrix like this:

string large_matrix[120000][7] = {};

If I create this array, it throws me a stack overflow exception. Does anyone know how to handle this problem? I do not want array as vector.

2
  • 2
    auto large_matrix = std::make_unique<std::array<std::arrray<std::string>,7>,2000>(); This will prevent it from being created on the stack. And still be contiguous in memory (I assume you don't want vector because of non-locality) Commented Dec 5, 2022 at 12:09
  • Probable duplicate: stackoverflow.com/q/15803291/10871073 Commented Dec 5, 2022 at 12:10

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.