This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Structure fields & RAM variables on the same address

I have a structure with various fields. And there are few global variables.
The structure fields and the global variables (basically status-flags) denote same information.
It doesnt make sense to have both of them in the RAM area. And i dnt wanna always use the '.' or '->' notations to access the structure fields as there are structure inside the structure.

Hence i feel that a way around is to use unions. But dont know how to use unions for structure in a structure type of variables. can somebody kindly give a small example or a good webpage detailing the same as i couldnt find any relevant thing on web highlighting such an example.

An example would be appreciable.
Thank you in advance.

0