Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Array causing Stack Overflow

$
0
0
Hey guys, I'm trying to create an array of integers with the size of 2,000,000. The program builds with no errors or warnings, however when I run it, it crashes. When I debug it I get a message saying Stack Overflow. After some time looking around in the debugger I narrowed down the source of my problem to the array. I understand this is a large array I'm trying to create, is there anyway around this or am I doing something wrong. The actual code I'm using to create the array is:

int arr[2000000];


Before anyone asks, yes it has to be an array. Would it be better if I created the array dynamically instead?

Thanks!

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>