Also be aware that the last valid index is N -1, not N.
Dumping a million numbers on the console might take a long time - maybe do it before your lunch break. :)
You're trying to create an array 7.5 MB in size, on the stack memory.
Under windows, the stack memory for a process is typically 1MB. As Heintzman says, you're overflowing the stack. You're trying to use more stack memory than you have been allocated.
Following on from Thomas, std::vector sounds like what you need.
I'm trying to do a vector with all v[i=1,2,4,8,16..]=1, and in rest 0, up to 1 000 000.
Someone have any idea?
1 2 3 4 5 6 7 8
std::vector<int> bigBinary(1000000, 0); // Create vector, size 1000000, all zeros
int i = 1;
while (i < 1000000)
{
bigBinary[i] = 1;
i = i*2;
}