AngryRobot

Multiple word values in a union?

3 posts in this topic

Is it possible to have multiple bool arrays and corresponding word values in a single union?

Say I want to create Test_Union, with an array of bool called BitsA and word value WordA;  and also BitsB and WordB- and keep the word values separate.  Is this possible?  Can I create a union of two unions?

I know I can technically create an union with multiple arrays and words, but BitsA would affect WordB and vice versa.

Share this post


Link to post
Share on other sites

If you don't want them to affect each other then create a Structure containing Union A and Union B. A Union is specifically designed to share the same memory locations.

1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now