Byte precision pointer arithmetic in C when sizeof(char) != 1

前端 未结 7 1258
悲哀的现实
悲哀的现实 2020-12-11 13:07

How can one portably perform pointer arithmetic with single byte precision?

Keep in mind that:

  • char is not 1 byte on all platforms
7条回答
  •  时光说笑
    2020-12-11 13:11

    According to the standard char is the smallest addressable chunk of data. You just can't address with greater precision - you would need to do packing/unpacking manually.

提交回复
热议问题