How does sizeof calculate the size of structures

后端 未结 6 1885
有刺的猬
有刺的猬 2020-12-16 15:37

I know that a char and an int are calculated as being 8 bytes on 32 bit architectures due to alignment, but I recently came across a situation where a structure with 3 short

6条回答
  •  一整个雨季
    2020-12-16 16:18

    This link should help: http://en.wikipedia.org/wiki/Data_structure_alignment

    In ThreeShorts all members are two byte aligned.

提交回复
热议问题