expression on global scope not allowed

 

Dear all,

what can I do?

//+------------------------------------------------------------------+
//|                                                      testing.mq4 |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright ""
#property link      ""

int a[4] = {1,2,3,4};
int b[5] = {10,11,12,13,14};

int aa, bb;
aa = ArrayRange(a,0);
bb = ArrayRange(b,0);

int c[aa][bb][20];


//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

Many thanks for your kind help!

wing

 
wing: what can I do?

learn to code

aa = ArrayRange(a,0); // not inside a function
bb = ArrayRange(b,0); // 

int c[aa][bb][20];    // not constant sizes
 

what I mean is, is there any way that index of an array outside a function can be dynamic?

I want to declare an array globally but it's index is dynamic.

 
wing:

what I mean is, is there any way that index of an array outside a function can be dynamic?

I want to declare an array globally but it's index is dynamic.

No, resize it instead . . .
 
and you can only resize the first index
Reason: