Tell me the use of bit field in C Language?
Submitted by: AdministratorBit Fields allow the packing of data in a structure.
This is especially useful when memory or data storage is at a premium
The maximum length of the field should be less than or equal to the integer word length of the computer.some compilers may allow memory overlap for the fields.Some store the next field in the next word.
C lets us do this in a structure definition by putting :bit length after the variable:
struct pack
{
unsigned int funny_int:9;
}p;
Also, Boolean datatype flags can be stored compactly as a series of bits using the bits fields. Each Boolean flag is stored in a separate bit.
Submitted by: Administrator
This is especially useful when memory or data storage is at a premium
The maximum length of the field should be less than or equal to the integer word length of the computer.some compilers may allow memory overlap for the fields.Some store the next field in the next word.
C lets us do this in a structure definition by putting :bit length after the variable:
struct pack
{
unsigned int funny_int:9;
}p;
Also, Boolean datatype flags can be stored compactly as a series of bits using the bits fields. Each Boolean flag is stored in a separate bit.
Submitted by: Administrator
Read Online C Functions Job Interview Questions And Answers
Top C Functions Questions
☺ | What is self-referential structure in C Programming? |
☺ | Tell me what is NULL pointer in C? |
☺ | What is C Programming structure? |
☺ | Tell me what is the purpose of "register" keyword in C Language? |
☺ | What is function prototype in C Language? |
Top C Programming Categories
☺ | C Functions Interview Questions. |
☺ | C Pointers Interview Questions. |
☺ | C Preprocessor Interview Questions. |