Does sizeof return the number of bytes or the number of octets of a type in C?

后端 未结 4 554
没有蜡笔的小新
没有蜡笔的小新 2021-02-02 12:09

Simply put in C and variants (unlike that wuss java with its virtual machine) the size of primitive types on different targets can vary greatly, and there is really no guarantee

4条回答
  •  遥遥无期
    2021-02-02 12:59

    sizeof gives the size in bytes. However, note that "byte" is a technical term in the C standard, and is defined such that sizeof(char) == 1.

提交回复
热议问题