I have a problem when initializing a large array of size as below:
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 ' ims_project.exe: Native' has exited with code 0 (0x0).
please help me with this problem.
// Allocate array dynamically
for (i=0; i<6; i++) a[i] = new float ;
... do your work with the array ...
float value = a  ;
// Release memory
for (i=0; i<6; i++) delete  a[i];
- 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).
std::vector > a;
See ya, Bilderbikkel