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:double x[500000];
Don't forget to delete the memory (with 'delete[]') after you are finished with it to avoid memory leaks.Code:double* x = new double[500000];
FAQ contributed by: [Kevin Hall]