Hi all,
I'm having a huge issue over a simple problem. I'm trying to initialize two arrays which are fairly large.
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
unsigned short Projections[336][265][283];
unsigned short Michelogram[18][18][336][283];
printf("\n-=<This program ran successfully>=-\n\n");
return 0;
}
This compiles fine, but when I run it, I get:
Segmentation fault (core dumped)
I've been compiling this snippet on gcc 3.3.2 in Red Hat Linux Fedora core 1. I haven't compiled this on Windows Bloodshed Dev-C++ yet.
What confuses me is that this code below works:
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
/*unsigned short Projections[336][265][283]; */
unsigned short Michelogram[18][18][336][40];
printf("\n-=<This program ran successfully>=-\n\n");
return 0;
}
By getting rid of one array, and toning down the other, it works.
It's almost as if these arrays have a maximum size, or something to that effect. At first, I thought this was a memory issue. The computer I'm running it on is a P3 300MHz w/ 128MB SDRAM. I compiled it on a Dual Xeon 2.4GHz with more RAM, but I still got the same error.
Anyone else have this problem?
Any suggestions would be extremely helpful.
Cheers,
Bri Rock