This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

struct memory access



I have a struct and need to create multiple instances before starting.  When loading data I am finding that variables are being copied between instances.  I think I must had done something silly.

=== im trying to have a golbal system struct...

master.sys.dclink1.voltage = 240;

master.sys.dclink2.voltage = 400;

=== after the folloing lines I end up with

master.sys.dclink1.voltage     is    400;

master.sys.dclink2.voltage     is    400;

=== this is how I have configured it

struct DCLINK{

float voltage;

float current;

};

union SYS{ 

struct DCLINK dclink1;

struct DCLINK dclink2;

} ;

struct MASTER{

union SYS sys;

};

struct MASTER master;