0

I'm trying to fill this array completely full with 3 bits of data each

unsigned long int array2[512][512];

but my program just keeps on crashing. does anyone know the solution?

  • 1
    If that is a local array, you perhaps break the stack. You can allocate the memory dynamically. – Weather Vane Sep 26 '22 at 17:58
  • 1
    It's like the site name says: stack overflow! – Steve Summit Sep 26 '22 at 17:58
  • You are trying to put `512 * 512 * sizeof(unsigned long)` bytes on the stack. That is roughly 2MB. Typical stack space is around 1MB. You have run out of stack-space. ***StackOverflow!*** – abelenky Sep 26 '22 at 19:49

0 Answers0