nested structures [message #84459] |
Mon, 27 May 2013 05:04 |
hannah_ue
Messages: 14 Registered: November 2012
|
Junior Member |
|
|
Hi there,
I have some questions about nested structures, i.e. if what I want is possible. I should say that I'm not familiar with pointers.
What I would need is an array of structures (which I know how to build) with one of the tags being another array of structures which should have different lengths, not known in the beginning.
I assume that I need pointers for this, but I do not understand how to assign certain values in this nested structure.
I also do not understand, how (or if?!) I can extend the nested structure.
So far, I have something like this:
struct1 = {A, tag_a1:0L, tag_a2:ptr_new(/allocate_heap)}
struct2 = {B, tag_b1:0.0, tag_b2: 0.0}
*struct1.tag_a2 = struct2
strlist = replicate({struct1}, 10)
strlist.tag_a2 = ptrarr(n_elements(struct1), /allocate)
Is this meaningful?
How can I replicate struct2 for one of the struct1's?
How can I assign a value in here, say tag_b2 = 1.5?
Should I better work with lists?
Thanks a lot for your help and clarifying!
Hannah
|
|
|