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.
8 people found this useful
Thanks for the feedback!

Why use bit Torrent?

Even though torrents are not always considered safe, millions of users make use of Bittorent to obtain copyright software,movies,music illegaly...    .torrent is simply

What is a bit?

Answer . Depends on the circumstances. . For computers a bit is the smallest possible unit of digital information, because it can have only two values, which can be interp

Is bit torrent easy to use?

  It's pretty simple once you get the hang of it. .torrent is a file extension used by a BitTorrent client or other peer-to-peer programs that use the BitTorrent protoco

Why parity bit is used?

Parity bits are mainly meant for error detection in serial communication.It will be use full for determining the correctness of data sent from transmitter to receiver. even p

What are forstner bits used for?

Drill bits are used in conjunction with hand drills or drill presses to make holes in woods, plastic and metals. A forstner bit is a particular type of drill bit that is often

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

Why are diamonds used in bits of drills?

Well, diamonds are hard minerals, and if they are used in a drill, it could help with the power given and make the course, and power of the drill increase. Diamonds are minera

How do you use 8 bit register as 16 bit register?

8 bit registers cannot be used as 16 bit registers. The reverse works, however, as the 16 bit general purpose registers of the 8086 and 8088 can be used as pairs of 8 bit regi

What is a bit used for on a horse?

A bit is used for control while riding. A bit should never be left in the horses mouth while unattended. To go along with that when removing your horses head stall and bit Let

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

How can you use A Bit Lucky in a sentence?

It was a bit lucky that I fell into a bush and not onto the sidewalk. The chess player got a bit lucky and had two easier opponents in the tournament.