|
Post by ppro06 on Aug 19, 2020 11:17:56 GMT -5
Hi everyone, I would like to confirm the syntax of nested structs and how to initialise them if the first member is a struct?
is it represented as
struct a, b as struct, d as long?
|
|
|
Post by Rod on Aug 19, 2020 11:48:41 GMT -5
I am not sure if the compiler cares but logically you declare b ahead of a. That is what I see in examples posted. But you might experiment. Structs are of course global.
|
|
|
Post by Chris Iverson on Aug 19, 2020 11:50:37 GMT -5
That really depends on HOW the struct is nested.
If the 'b' member of struct 'a' is a pointer to another struct, then your example should work.
If the 'b' member is not a pointer, but is fully embedded in struct 'a', then for LB, you would need to take all of struct b's members, and make them part of struct 'a', right where struct 'b' would normally go.
Do you have the definition of the struct you're trying to work with?
|
|
|
Post by ppro06 on Aug 19, 2020 12:03:08 GMT -5
Thanks I think I am all right now, listing all the members with the specific struct name as prefix seems to work.
|
|