More intelligent approach for indexing?

 

I declared integer :

input int  MaxBars=100;

and structure:

struct BarInfoStruct
 {double  Medium;
  double  Speed;
  int        Weight;};

Now I want to use that integer in declaring structure array:

BarInfoStruct BarInfo[MaxBars]; (- incorrect declaring, gives error)

and of course for cycling through that array

For (int i=0;i<MaxBars;i++) {

  BarInfo[i].Weight=0;}

Problem is that for cycling is possible to use that declared MaxBars but not for declaring BarInfo size. Is there intelligent way for declaring both array size and index running limit?

 
BarInfoStruct BarInfo[]; 

...

int OnInit()
{
...
  ArrayResize(BarInfo,MaxBars);
...
}
Reason: