Information on Bit Arrays in C

S

ssubbarayan

Dear all,
I would like to learn regarding Bit arrays from basics up to
implementation level.Typically I am looking for understanding their
utility,their implications and how they are different from bit fields?
I searched in this group for some info but I am not finding the basic
stuff I am looking for.It would be helpful if some one can explain me
this or point me to some good links or books where I can learn
regarding Bit Arrays in C language.
In our project we extensively use it,since the code was written by some
one else whos not in touch with our co,I am jus trying to learn myself.
Looking farward for all your replys and advanced thanks for the same,
Regards,
s.subbarayan
 
C

Cong Wang

ssubbarayan said:
Dear all,
I would like to learn regarding Bit arrays from basics up to
implementation level.Typically I am looking for understanding their
utility,their implications and how they are different from bit fields?
I searched in this group for some info but I am not finding the basic
stuff I am looking for.It would be helpful if some one can explain me
this or point me to some good links or books where I can learn
regarding Bit Arrays in C language.
In our project we extensively use it,since the code was written by some
one else whos not in touch with our co,I am jus trying to learn myself.
Looking farward for all your replys and advanced thanks for the same,
Regards,
s.subbarayan
Read the book--C Unleashed,whose authors are often here.And enjoy it!
 
C

Charles Mills

ssubbarayan said:
Dear all,
I would like to learn regarding Bit arrays from basics up to
implementation level.Typically I am looking for understanding their
utility,their implications and how they are different from bit fields?

Their utility really depends on the problem, but in general you can use
a bit array to represent a sequence of binary states.
The difference between bit arrays and bit fields depends on how the bit
array is implemented, but most bit arrays I have seen are implemented
using a dynamic array unsigned chars or integers. Given that a bit
array is resizable at runtime, while a struct with bit fields is not.
If you can enumerate the binary states at compile time than bit fields
may be useful (or just some boolean variables), if not then a bit array
is probably better. (Also bit fields are used for messing with the
binary representation of floats and other stuff - usually not
portable.)
I searched in this group for some info but I am not finding the basic
stuff I am looking for.It would be helpful if some one can explain me
this or point me to some good links or books where I can learn
regarding Bit Arrays in C language.

Maybe start here:
http://en.wikipedia.org/wiki/Bit_array
I think you will find many bit array implementations by googling a bit.
In our project we extensively use it,since the code was written by some
one else whos not in touch with our co,I am jus trying to learn myself.
Looking farward for all your replys and advanced thanks for the same,
Regards,
s.subbarayan

Good luck.

-Charlie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top