Arrays of bits
Posted on 2002-07-24
I've been trying to create an array of bits so that I can manipulate each bit of a particular data type. I've been somewhat successfull, however the values for the bits in the array don't match the value input. I don't know what the problem is. Something like this:
unsigned bits : 1;
bits32.int32 = 123456;
for (int i = 0; i < 32; i++)
cout << "bit" << i << ": " << bits32.bits[i] << endl;
This doesn't give the write output. Does anybody know why? Thanks for the help.