How does the compiler determine the size of a structure containing bit fields?

  • It uses a fixed size for all structures
  • It sums the sizes of individual bit fields
  • It calculates based on the alignment requirements
  • It uses a predetermined value
The correct option is c) It calculates based on the alignment requirements. When a structure contains bit fields, the compiler determines the size of the structure based on the alignment requirements of the platform. It may add padding bits to ensure proper alignment, which affects the overall size of the structure.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *