Q: Why does declaring an array cause my program to crash?
A: Because such a large piece of memory exceeds the stack size (a stack overflow). You need to allocate the memory on the heap instead:Code:
Don't forget to delete the memory (with 'delete') after you are finished with it to avoid memory leaks.Code:
double* x = new double;
FAQ contributed by: [Kevin Hall]