It depends where you allocated the array. If it's inside a function, then the variable is allocated on the stack, and by default, (I assume you're running linux) the stack size is 8Mb.
You can find it out using ulimit -s
and also modify this value, for instance ulimit -s 1000000
.
You may want to have a look on those questions:
- Memory allocation for global and local variables
- Segmentation fault on large array sizes (suggested by @Ed)