Your question is very unclear, but I suspect that you are trying to create a large multidimensional array (matrix) as a local variable (auto variable) to some function (possibly main) and this is failing.
int foo(int boo, int doo) {
int big_array[REALLY_BIG];
...
This would fail because C compilers try to make room for variables like this on the programs system stack. A compiler may just fail upon attempting to think about something that big being on the stack (especially with alignment issues that might make it bigger) or it may generate code to try to do this and either the CPU can't run it because stack pointer relative indexing is limited or because the OS has placed limits on the size of the program's system stack.
There may be ways to change OS limits, but if it is a CPU limit you are just going to have to do things differently.
For some things the simplest thing to do use just use global or static
variables for large sized data such as this. Doing this you end up allocating the space for the data either at compile time or at program load time (just prior to run time), but limits your ability to have more than one copy since you have to plan ahead to declare enough global variables to hold everything you want to be live at the same time.
You could also try using malloc
or calloc
to allocate the memory for you.
A third option is (if you are using a *nix system) to memory map a file containing the matrix. Look into the mmap
system call for this.
An added benefit of using mmap
or static
or global variables is that under most operating systems the virtual memory manager can use the original file (the file containing the matrix for mmap, or the executable file for static or global) as swap space for the memory that the data uses. This makes it so that your program may be able to run without putting too much of a strain on the physical memory or virtual memory manager.