I want to create an array that is capable of storing 10^9 numbers(long int).If i try doing this my compiler crashes.What is the maximum size array allowed in C++.Also if i d
An array of 10^9 longs would typically take up at least 4GB of memory, which would already be prohibitive in all 32-bit systems.
Even if that much memory is available in a 64-bit system you certainly cannot expect to allocate 4GB on the stack like this:
void foo() {
long arr[1000000000]; // stack size is a typically few MBs!
}