InterviewSolution
| 1. |
What Do You Know About The Use Of Bit Field? |
|
Answer» Packing of data in a structured format is allowed by using bit FIELDS. When the memory is a premium, bit fields are extremely useful. For example:
This type of operations is supported in C language. This is achieved by putting :'bit length' after the variable. Example: struct packed_struct { packed-struct has 6 members: four of 1 bit flags each, and 1 4 bit type and 1 9 bit funny_int. C packs the bit fields in the structure automatically, as compactly as possible, which provides the maximum length of the field is less than or equal to the integer word length the computer system. The following points need to be noted while working with bit fields:
Packing of data in a structured format is allowed by using bit fields. When the memory is a premium, bit fields are extremely useful. For example: This type of operations is supported in C language. This is achieved by putting :'bit length' after the variable. Example: struct packed_struct { packed-struct has 6 members: four of 1 bit flags each, and 1 4 bit type and 1 9 bit funny_int. C packs the bit fields in the structure automatically, as compactly as possible, which provides the maximum length of the field is less than or equal to the integer word length the computer system. The following points need to be noted while working with bit fields: |
|