Hi, I'm trying to figure out what's going wrong in a simulation I'm writing. It probably has something to do with the lot of big arrays. I can get it down to the following:
Code:
#include <iostream>
#include <ctime>
#include <cstdlib>
#define BIG 1000000
using namespace std;
int main()
{
unsigned int myints[BIG];
unsigned int myints2[BIG];
unsigned int myints3[BIG];
srand(time(NULL));
rand() % 5; // can be any number here
return 0;
}
As is, this causes a segmentation fault. However if any of the lines are removed or commented out, there are no errors. Also if you take one 0 off of BIG, there are no errors. I don't think I'm out of memory because I can add myints4[BIG], myints5[BIG], etc if the random numbers are removed.
I have no idea what's going on here..