what happens if i try to put an union to array. I want to have two ways of programing the code one way is to use (bits) the other to use intigers. Let me explain in the followinf example:
Code:
typedef union
{
struct
{
unsinged a1:1;
unsigned a2:2;
unsigned a3:3;
unsigned a4:4;
unsigned a5:5;
.
.
.
}bits;
int ALL;
}Coils;
Code:
int main()
{
...
Coils coil;
coil.ALL Coils[200]; // now i have 200 int variables?
coil.bits.a1 = 1; // the other way to program?
}
it will also change the value of the array? Or I must use pointers? If you have any better solution please feel free to share it.Thanks and
best regards,
BoSCHoW.
