Download MetaTrader 5

retrieving structure variable data from an array of that structure data type

To add comments, please log in or register
Have you installed MetaTrader 5? Find out more about it!
Brian Kester
Brian Kester 2014.06.18 17:33 

Hi, I am learning to use an array of the structure data type.  Specifically, to access the multiple dot-notated variables' from the structure array .


I can declare a structure, list the variables, assign data to those dot-notated variables, declare an array from the structure data type, assign the structures' dot notated variables to the array, but then how to access the data from the multiple dot-notated variables in each index of the array is where im stuck.

I have read up on arrays, but when each index contains multiple variables (each followed by semicolon) i'm not clear how get the data from any one of the multiple dot-notated variables of any single index  of the array.


I know structure parameters must be passed by reference, which means (i think) if you change the structure inside a function, the changes to it are not saved outside the function.


So, i think I have most of the peices of the puzzle, but I'm missing a few peices to have a complete picture. thanks for any help. Sorry for so many posts lately, im in the steep part of my learning curve.

Brian Kester
Brian Kester 2014.06.18 17:43  

  WHRoeder had replied to me elsewhere already -


It's exactly the same
int ints[9];
int i = ints[2];

struct ab{ int a; int b };
struct abs[9]
struct s=abs[2]; Print(s.a);
//or just
Print( abs[2].a );




thanks a lot WHRoeder! 

Brian Kester
Brian Kester 2014.06.22 14:12  

working great :)

To add comments, please log in or register