Structs In an Array or an Array of Structs


I’m using Structs for the first time and not sure what the best method to use is.

So I think I need a struct like this…

Struct Task (OptionA, OptionB, OptionC)

Now if I want to have multiple tasks should I have…

An Array of Structs

TaskArray = #(TaskA OptionA:ValA OptionB:ValB OptionC:ValC,TaskB OptionA:ValA OptionB:ValB OptionC:ValC,TaskC OptionA:ValA OptionB:ValB OptionC:ValC)


An Array of Structs

Tasks = Task (OptionA:#(ValA,ValA,ValA), OptionB:#(ValB,ValB,ValB), OptionC:#(ValC,ValC,ValC))

Any good examples or documentation?




hi Dave, the first option would be my approach (IMHO), compiling an array of the instantiated structs, rather than multiple arrays of struct parameters.

An example can be found here -

I use an array of structs to retrieve morpher key data from XML. The struct in my example is called keydata. I found that easier to iterate and restore the keys this way. It seems to be a more OO based approach to me!


Definitely the first option, a bit pointless to use a struct otherwise.


Yep cheers guys, After a few mins of playing around it seems completely obvious now, option 1 is the way.


This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.