0

The following code doesn't work, but I think it's clear what I want to do:

my.struct = 1;
foo.bar = my.struct;

So that

foo.bar.struct = 1

Basically I want to fill in the my structure array with a bunch of fields and values. Then I want to place that struct as a nested struct within foo.bar while retaining the field names.

1
  • you're talking about arrays, but I see none in your example code.. you're sure you're dealing with arrays? Commented May 10, 2013 at 19:42

1 Answer 1

1
my.struct = 1;
foo.bar = my.struct;

this just places the value of my.struct (=1) in foo.bar. Of course then foo.bar is just 1.

I think you're after this:

my.struct = 1
foo.bar = my;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.