Error: Total size of array must not exceed 0x7fffffff bytes

前端 未结 2 783
遥遥无期
遥遥无期 2021-01-05 23:41

I have a small C++ program that requires a large 2d array.

int distanceArray[282][9900000];

I am aware that a standard 32 bit console appli

2条回答
  •  逝去的感伤
    2021-01-05 23:59

    As suggested by MSalters, an std::vector> was definitely the way to go.

    For anyone who is still having this problem, here is how I initialized it:

    std::vector> distanceArray(282, std::vector(9000000, -1));
    

    9,000,000 columns are created within every row of 282 items, and each value is initialized to -1 at the start.

    Thanks to everyone who commented for the help!

提交回复
热议问题