Problem with definition of array

Hello!
I have a problem with definition of array.
In my macros I need to create an array ( eta_lj[s] ) with changeable dimension (s).
If I define “s” like “Int_t s = lj.size();” then I get this error:

Error: Non-static-const variable in array dimension plots.C:64:
(cint allows this only in interactive command and special form macro which
is special extension. It is not allowed in source code. Please ignore
subsequent errors.)
*** Interpreter error recovered ***

And if I define it like “const Int_t s = lj.size();” then I get:

nev = 10000
lj_size = 2
lj_size = 3
Error: Array index out of range eta_lj -> [2] valid upto eta_lj[1] plots.C:68:
*** Interpreter error recovered ***

Could anybody help me, what is the correct way to define my array?
That is the part of my macros:

void plots() {
for ( nr = 1; nr <= 2; ) {

for( Int_t ev = 0; ev < nev; ++ev ) {
const Int_t s = lj.size();
cout << "lj_size = " << s << endl;
Double_t eta_lj[s];

for( Int_t nlj = 0; nlj < s; ++nlj ) {
eta_lj[nlj] = lj[nlj].eta();
h5->Fill(eta_lj[nlj]);
}
}
}

}
Thank you in advance.

Hi,

CINT does not yet support VLA (aka ‘fixed’ sized array whose size can change for each run of the function). As stated in the error message you array size (variable s) must also be ‘static’.

Cheers,
Philippe