0

I am currently creating a large array that looks like this:

unsigned char arr[35000][500];

I then try to write in 256 characters into the array like so:

for(i=0; i < 256; i++)
{
  arr[i][0] = i;
}

When I do this, I get the following seg fault:

Program received signal SIGSEGV, Segmentation fault.
0x00000000004007e3 in main () at arr.c:41
41        arr[i][0] = i;

Any suggestions on why this is happening?

user081608
  • 1,093
  • 3
  • 22
  • 48

1 Answers1

1

You probably have some stack overflow happening. Consider using dynamic memory allocation

sedavidw
  • 11,116
  • 13
  • 61
  • 95