Hi,
I am goint to create a very large array but have this error when running this code
#include <iostream>
#include <limits.h>
#include <cstddef>
#include <cmath>
using namespace std;
int main()
{
cout << UINT_MAX << " " << ULLONG_MAX << endl;
cout << pow(pow(24,2),4) << endl;
unsigned long long int n = pow(pow(24,2),4) ;
cout << n << endl;
double * p = new double (pow(pow(24,2),4));
for (unsigned long long int i = 0; i < n; i++)
p[i] = i;
delete [] p;
return 0;
}
The running stops at i = 16895 giving
Debugger name and version: GNU gdb 6.8-debian
Program received signal SIGSEGV, Segmentation fault.
What's the ways to deal with large size array? I am not sure it C++ std library's various containers will work but I guess they might be too slow and not efficient, so it is slightly better to stick to normal array?
Thanks in advance!