Integer Array Size Problem

Tim Prince timothyprince@sbcglobal.net
Sun Dec 17 16:19:00 GMT 2006


Digvijoy Chatterjee wrote:
> Hi ,
> I was trying to test algorithms with huge int arrays when i started
> getting segfaults..here is a simple program which emulates this
> behaviour...
> Each time i run this program , it segfaults , This might be very naive
> ..but can anyone help me with what I am missing here ?
> 
> static const int N=10000000;
> int main()
> {
> int c, i[N];
> for (c=0;c<N ; c++ )
> i[c]=c;
> }
> 
Evidently, this depends on platform (e.g. 32- or 64-bit), possibly on 
compiler options (e.g. mc-model) or shell settings (e.g. ulimit), none 
of which you have divulged. Not giving such information doesn't make it 
On Topic.



More information about the Gcc-help mailing list