- you can define the array sizes only with fixed numbers:
#define a 0 #define i 1 double test[a][i], test2[][1]; // that would work
- see in the reference (editor -> f1 -> ArraySize() or google for examples for multi-dimension arrays
Here's an easy solution... use this data collection type instead ;)
#include <Custom\two_dimensional_data.mqh> void OnStart() { TwoDimensionalData<double> arr; arr.Set(3.14159,3,4); arr.Set(1.21,1,2); Print("Get method 1 = ",arr.Get(3,4)); double num; Print("Get method 2 = ",arr.Get(num,20,20)," = ",num); Print("Array is ",arr.Total_D1()," by ",arr.Total_D2()); for(int i=0;i<arr.Total_D1();i++) for(int j=0;j<arr.Total_D2();j++) Print("iterate_array[",i,"][",j,"] = ",arr.Get(i,j)); }
File attached
Files:
Carl Schreiber:
I wouldn't a double dimension at all. Use a structure.- you can define the array sizes only with fixed numbers:
#define a 0 #define i 1 double test[a][i], test2[][1]; // that would work
- see in the reference (editor -> f1 -> ArraySize() or google for examples for multi-dimension arrays
struct aType{ double a[5]; int i; double get(){ return a[i]; } } aType test2[]; ... test2[x].i=...

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
hello everyone,
I think this maybe an easy problem to solve, but I can't get it to work with out causing an error.