-
Array of bits?
Hello
I would like to be able to create an array of (for example) 16 or 18 or 40 or 100 bits.
I'm aware I can create an array of unsigned chars and simply use the bits I want from that, but I'd prefer a custom bit array which I can operate on as a whole without worrying about which byte (i.e. unsigned char array element) my bit is in.
Is this possible?
Any pointers appreciated.
Thanks.
-
If you have a struct, you're allowed such a thing as a bitfield -- but you can't access bits using array notation (they're really just variably-sized ints) or anything like that. So that's probably not what you wanted at all.
-
-
Thanks for the replies.
Dave_Sinkula: would I be able to perform shifts (e.g. >>) using a bit set?
-
You could write a function similar to this, I suppose.
-