Accessing bit-field in C by its address

后端 未结 3 778
感动是毒
感动是毒 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 00:44

    In c smallest addressable unit of memory is considered a Byte. A pointer points to a memory location which can be of any data_type (a pointer is also another variable). Bits receding in byte don't have any address , rather they do have a bit position.

    So basically you can not point to particular bit , you can point to a byte or whole word.

提交回复
热议问题