Saturday 15 January 2011

c++ - Segmentation fault when I create a little too big array -



c++ - Segmentation fault when I create a little too big array -

this question has reply here:

segmentation fault on big array sizes 5 answers

i have c++ object in part of code this:

class object { public : float a, b, c; }

when create 2 dimensional array this, works fine :

object myarray [500][500];

when create this, segmentation fault :

object myarray [1000][1000];

what causes segmentation fault, how can rid of it? thanks.

to create huge array, need create global. local variables have size limit. solution allocate array dynamically.

c++ c arrays segmentation-fault

No comments:

Post a Comment