Set array element via variable

 

I'm trying to set up an 18 element array of double values where the double values are previously set as variables. However, initializing an array as follows doesn't seem to work:


double Levels[18]={H1, HC1, M1, LC1, L1, O1, C1, P1, H2, HC2, M2, LC2, L2, H3, HC3, M3, LC3, L3};

How do I insert double values as variables into a double array?

 

Nevermind. I think I got it as follows:

double Levels[18];

Levels[0]=H1; 

Levels[1]=HC1; 

Levels[2]=M1;

Levels[3]=LC1;

Levels[4]=L1;

Levels[5]=O1;

Levels[6]=C1;

Levels[7]=P1;

Levels[8]=H2; 

Levels[9]=HC2; 

Levels[10]=M2;

Levels[11]=LC2;

Levels[12]=L2;

Levels[13]=H3; 

Levels[14]=HC3; 

Levels[15]=M3;

Levels[16]=LC3;

Levels[17]=L3;  
 
double Levels[18];

Levels[0] = H1 ; Levels[1] = HC1,  . . . . , Levels[17] = L3
 
double Levels[18]={H1, HC1, M1, LC1, L1, O1, C1, P1, H2, HC2, M2, LC2, L2, H3, HC3, M3, LC3, L3};
This form can only be used with constants. The 18 is optional, if not specified defaults to number of items in the list.