Declaration of Array Error message from compile MT4build 600 - page 3

 
honest_knave:

Unfortunately, unless you post up your code I can't help you.

As you can see from my example above (and the examples in the documentation) it works. 

Good luck!

this is my code :

#property strict
extern int Count=4;                                    // Global variable
int OnInit()
  {
   #define l (Count)
   double wInput[l];
   for(int cnt=0;cnt<ArrayRange(wInput,0);cnt++){
      wInput[cnt]=MathRand();
      Alert(wInput[cnt]);
   }
   return 0;
   }

i want to get a number from user then use it to define an array than randomly initialize it.

i want to use multi dimention and using resize is not an option because i cannot define dynamic array more than one dimention.
 

You can't use a variable (Count) to define the constant (l) 

#property strict
extern int Count=4;                                    // Global variable

int OnInit()
  {
   double wInput[];
   ArrayResize(wInput,Count);
hossein71:


i want to use multi dimention and using resize is not an option because i cannot define dynamic array more than one dimention.

Yes, you can have a dynamic multi-dimensional array, but only the first dimension can be dynamic e.g.

   double wInput[][2];
   ArrayResize(wInput,Count);
 
honest_knave:

You can't use a variable (Count) to define the constant (l) 

Yes, you can have a dynamic multi-dimensional array, but only the first dimension can be dynamic e.g.

that is the problem i should input two dimensions  and then define it!

it is very bad that mql has such restriction !!!!

 

There are always ways around things.

You can create an array of structures. The structure contains an array.

You can resize the array of structures, and you can resize the array inside the structure.

e.g.

   struct my_struct { double inner[]; };
   my_struct outer[];
   ArrayResize(outer,2);
   ArrayResize(outer[0].inner,3);
   ArrayResize(outer[1].inner,4);
 
honest_knave:

There are always ways around things.

You can create an array of structures. The structure contains an array.

You can resize the array of structures, and you can resize the array inside the structure.

e.g.

cool, thanks bro.
Reason: