I wrote the following piece of code to allocate memory for an array:
try { int n = 0; cin >> n; double *temp = new double[n]; ... } cat
If you are using Visual Studio for building, you may want to enable "large memory allocation" in Linker settings.
Go to project Properties -> Linker -> System -> Enable Large Addresses set to "Yes (/LARGEADDRESSAWARE)"