6
const int L=10;
std::complex<double> c_array[L][L][L][L][L][L]    // 6 dimensions

所需空间:2*8*10^6 字节

它不应该用完所有的内存,对吧?

4

1 回答 1

8

There is a stack size limit for every processes. Therefore, if you really want to create this array locally (in the stack), the only solution is to increase the stack size limit for your program. How to change the stack size limit depends on your OS.

Alternative is to create this array in the heap. To do that you have to use "new" keyword as follows.

std::complex<double> *c_array = new std::complex<double>[L][L][L][L][L][L]; 
于 2013-07-08T05:10:51.517 回答