What would you like to do?

What are bit fields What is the use of bit fields in a Structure declaration?

already exists.

Would you like to merge this question into it?

already exists as an alternate of this question.

Would you like to make it the primary and merge this question into it?

exists and is an alternate of .

Both C and C++ allow integer members to be stored into memory spaces smaller than the compiler would ordinarily allow. These space-saving structure members are called bit fields, and their width in bits can be explicitly declared. Gagandeep Singh Bitfields can only be declared inside a structure or a union, and allow you to specify some very small objects of a given number of bits in length. struct { /* field 4 bits wide */ unsigned field1 :4; /* * unnamed 3 bit field * unnamed fields allow for padding */ unsigned :3; /* * one-bit field * can only be 0 or -1 in two's complement! */ signed field2 :1; /* align next field on a storage unit */ unsigned :0; unsigned field3 :6; }full_of_fields; The main use of bitfields is either to allow tight packing of data or to be able to specify the fields within some externally produced data files.
13 people found this useful
Thanks for the feedback!

What is bits?

Bits are way measuring data. Eight bits equal one byte. One  thousand bytes equal one kilobyte. One thousand kilobytes equal one  megabyte and so on.

How can you define a structure with bit field members?

      We can  define structure bit field members with Dot operators.    EXAMPLE:    #include    int main()    {      Str

If a computer has a maximum of 2N memory cells then each address field in a machine language instruction must be how meany bits wide to enable us to address every cell?

If there are 2^n cells then you need at least n bits to address each cell individually. For example, if there 2^32 cells then you need at least 32 bits to address each of the

What is the fee structure of BITS-pilani?

FeesIntegrated First Degrees / Admission Fees15,000/-* / Semester FeesFirst SemesterSecond SemesterSummer term40,000/-40,000/-20,000/- / Students' Union fee200/- pa / Students
In Uncategorized

What are bits used for?

A bit is Background Intelligent Transfer Service. Bits will only transmit data when there is enough bandwidth not currently being used. It is most commonly used for microsoft
In Uncategorized

A bit is a?

A bit is the basic unit of information in computing. A bit has a  single binary value, either 0 or 1.

What is the use of bit field in structure declaration?

A bit field allows you to assign an arbitrary number of bits to a  member.    As an example, suppose we wish to implement an R6000 PPN (physical  page number). A PPN