Accessing bit-field in C by its address

后端 未结 3 747
感动是毒
感动是毒 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:09

    The smallest unit of addressable memory in C is a char, because this corresponds to the smallest unit of addressable memory on most CPU architectures.* It doesn't make sense to talk about the address of a bit.


    * One could imagine a hypothetical machine that allowed addressing of individual bits, but it would be pretty esoteric.

提交回复
热议问题