Accessing bit-field in C by its address

后端 未结 3 751
感动是毒
感动是毒 2021-01-07 00:33

What is the reason behind not allowing to access a bit field in C using its address, is it cause it might not be an address that is not system word aligned ..? or as it does

3条回答
  •  一向
    一向 (楼主)
    2021-01-07 01:01

    Bits do not have addresses. That's why you can't refer to them by address. The granularity of addressing is the char.

    I guess the reasoning is that the language was design to match the architecture it targeted, and I know of no machine which allows addressing of individual bits.

提交回复
热议问题