Reputation: 169
In C++, what is the maximum size of a one dimensional array of complex doubles (i.e. std::complex<double> array[dimension]
)?
Is there a difference to the max size if I declare the array in main versus globally?
Upvotes: 2
Views: 709
Reputation: 238351
The maximum size of the array will be M / sizeof(std::complex<double>)
bytes where M
is the remaining free memory in bytes. Amount of free memory is affected by how much total memory there is, and by how much memory is used for other purposes.
If you declare the array as an automatic variable, then it will have automatic storage. The amount of automatic storage is limited on most systems. Typical total automatic storage shared by all automatic variables is one or few megabytes.
Upvotes: 2