0

I have to create static 3D array 200x200x200, but when I try to compile this code

int main()
{
    int arr[200][200][200];
    return 0;
}

program crashes. Debugger displays this error:

Program received signal SIGSEGV, Segmentation fault.

Does anyone have idea how to solve this?

Fabian
  • 33
  • 6

1 Answers1

0

You are running out of space: 200*200*200*4(32 bit system int) are ~32MB. You cannot allocate that much space in the stack. Answer 1 and Answer 2

Find another solution that involves computing less numbers, for example using temporal results to find other results, or saving values to file and loading them when needed

Community
  • 1
  • 1
Hennio
  • 433
  • 2
  • 18