I have this code that assigns an array of 8 elements to a pointer that points to a instance j of a custom structure (Input_Leo):
In CFNN.cpp:
{
double tx_tech_variable_vec[8] = { 0 }; //I need this re-initialization // code testing: variable rates on the initial premium payment of FIB/Invest Products with a time-variable garantueed interest rate */*/
tx_tech_variable_vec[0] = 3.0; // it does not help to declare it in CFNN.H, as part of the InputLeo structure, you have to do it here before also
tx_tech_variable_vec[1] = 1.5;
DATE tx_tech_variable_dates_vec[8] = { 0, 0 }; // initialization
tx_tech_variable_dates_vec[0] = { 2026, 07 };
tx_tech_variable_dates_vec[1] = { 2032, 07 }; // assignment
j->tx_tech_variable_vec = tx_tech_variable_vec; // overwrites everything (so for each contract (subcontract?), a new vector is written to j)
j->tx_tech_variable_dates_vec = tx_tech_variable_dates_vec; // overwrites everything (so for each contract (subcontract?), a new vector is written to j)
}
In CFNN.H:
struct Input_Leo /* input for Leo */
{
DATE calculation_date = { 2000, 0 }; // Calculation date (used for RADP as date of the payment of unexpected premium)
DATE cohortmonthly = { 2000, 0 }; //date payement prime conclusion (used in total business mode for the month of payment of yearly premiums, to know if we reached 12 months of historic of unex premiums)
int lnumcon = 0; // Contract number
int cregfsc = 0;
and so on...
double* tx_tech = nullptr; // pointer on Tx_res_LEO to allow for dynamic memory allocation, depending on the number of subcontracts
double tx_tech_variable_vec[8] = {0};
DATE tx_tech_variable_dates_vec[8] = {0, 0}; /* code testing not sure I need to add it here */
};
I get this error:
Line Severity Code Description Project File Suppression State
4681 Error C3863 array type ‘double [8]’ is not assignable CF_2012_V7 C:UsersU03630SourceReposctoolMaincodeCFNN.CPP
Line Severity Code Description Project File Suppression State
4682 Error C3863 array type ‘DATE [8]’ is not assignable CF_2012_V7 C:UsersU03630SourceReposctoolMaincodeCFNN.CPP
What do I do wrong here? Should I specify the lenght of the array myself explicitly?