Hi,
I have a problem when initializing a large array of size as below:
int main()
{
float a[6][56000];
getch();
return 0;
}
I need such size of array for my project but c++ builder is throwing me error-
Loaded 'C:WINNTWinSxSx86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_f75eb16cmsvcr80d.dll', Symbols loaded.
'ims_project.exe': Loaded 'C:WINNTsystem32msvcrt.dll', No symbols loaded.
First-chance exception at 0x00411437 in ims_project.exe: 0xC00000FD: Stack overflow.
Unhandled exception at 0x00411437 in ims_project.exe: 0xC00000FD: Stack overflow.
The program '[3912] ims_project.exe: Native' has exited with code 0 (0x0).
please help me with this problem.
Comments
float* a[6];
int i;
// Allocate array dynamically
for (i=0; i<6; i++) a[i] = new float [56000];
... do your work with the array ...
float value = a [4] [34872];
// Release memory
for (i=0; i<6; i++) delete [] a[i];
[/code]
- create the arrays dynamically (as shown in other reply)
- use a std::vector (which does the dynamic allocation and deallocation for you)
In C++, prefer a std::vector over an array (see http://richelbilderbeek.nl/CppVector.htm for references).
[code]
#include
std::vector > a;
[/code]
See ya, Bilderbikkel