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.

Parents
  • But those are the way that the 'C' programming language uses to access structure members!
    You have no choice!

    Adding unions will make absolutely no difference whatsoever to that!

    "dont know how to use unions"

    'C' textbook time, then!

    Nothing specifically to do with Keil or ARM or embedded.

    blog.antronics.co.uk/.../

Reply
  • But those are the way that the 'C' programming language uses to access structure members!
    You have no choice!

    Adding unions will make absolutely no difference whatsoever to that!

    "dont know how to use unions"

    'C' textbook time, then!

    Nothing specifically to do with Keil or ARM or embedded.

    blog.antronics.co.uk/.../

Children