Is there a max array length limit in C++?

后端 未结 12 1543
深忆病人
深忆病人 2020-11-22 07:21

Is there a max length for an array in C++?

Is it a C++ limit or does it depend on my machine? Is it tweakable? Does it depend on the type the array is made of?

12条回答
  •  心在旅途
    2020-11-22 08:00

    i would go around this by making a 2d dynamic array:

    long long** a = new long long*[x];
    for (unsigned i = 0; i < x; i++) a[i] = new long long[y];
    

    more on this here https://stackoverflow.com/a/936702/3517001

提交回复
热议问题