// curve scenario
typedefstruct
{
int id;
double tenor[_NO_TENORS];
double zeroRate[_NO_TENORS];
double df[_NO_TENORS];
} curveScenario;
// curve data
typedefstruct
{
string name;
string currency;
string country;
string interpolate;
int interpolation;
int scenariosNo;
int tenorsNo;
curveScenario scenario[_NO_SCENARIOS];
} curveData;
The problem is that
curveData curve;
ends with an error when I run the code (compilation is OK though). This is probably because of the line
curveScenario scenario[_NO_SCENARIOS];
When I comment the line, the code works fine. So my question is what's the correct way to create an user defined datatype based on another user defined datatype.
Thx a lot in advance,
Michal
PS: I would like to avoid "going around" this problem through creating a special object.
That code is fine. In general, runtime errors are not caused by declarations. There should be something wrong with the rest of your code.
You'll have to post more code. Although, before you do that, try eliminating as many irrelevant parts as you can.
Hello, you are right - it seems that I exceeded memory that could be allocated to the datatype (I had _NO_SCENARIOS = 10000 and _NO_TENORS = 50). I am using 32b Windows Vista. Could upgrade to 64b OS help? Best regards, Michal
If you need that much memory, allocate your structure on the heap (malloc in C or new in C++).
Stack is, I think, usually set to be 1 MB, while heap can be resized.