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,051
  • 3
  • 21
  • 47

1 Answers1

1

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

sedavidw
  • 10,038
  • 12
  • 53
  • 88