Discussion
If the declaration unsigned c:5; is replaced by unsigned : 6; then
Answer: C
Correct answer: compiler will give a new name for the field
A bit-field declared without a name - unsigned : 6; - is an unnamed bit-field, which is legal C. It reserves the stated number of bits as padding but provides no name by which they can be accessed.
Its purpose is layout control: unnamed fields are used to align the following members at a particular bit position when a structure is mapped onto a hardware register or a defined external format. A width of zero has a further special meaning, forcing the next field to begin at the next storage unit.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development