payne:
Could you explain your problem? Did you get any error?
I did small example.
Hi Alexvd,
It seems that using a struct as the array type is causing the issue. Note that even though the array is dimensioned as tmp[3][5], accessing the array tmp[0][4] is invalid, yet tmp[4][0] is valid and has the correct data...although it appears to be in col-major order.
struct foo{
string txt;
int val;
};
foo tmp[3][5];
int val;
for(int row=0; row< ArrayRange(tmp,0); row++){
for(int col=0; col<ArrayRange(tmp,1); col++){
val = 10*(1+row) + (1+col);
tmp[row][col].txt = IntegerToString(val);
tmp[row][col].val = val;
}
}
payne
Thank you for your message. Fixed. Please wait for updates.
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
In computing, row-major order and column-major order describe methods for storing multidimensional arrays in linear memory.
Following standard matrix notation, rows are identified by the first index of a two-dimensional array and columns by the second index.
I declared an array as: MyArray[2][3] and loaded with simple loop *thinking* that arrays are stored in row-major order, such as MyArray[row][col];
However, in the debugger, the array appears to be in col-major order since my *watch* expression of MyArray[row][col] does not work! Instead I have to use col-major with my *watch" expression, ie, MyArray[col][row];
Can somebody please clarify the array ordering as I have not been able to fine the definitive answer in the documentation.
Thanks in advance,
payne