Is it true that endianness only affects the memory layout of numbers,but not string?

后端 未结 4 1896
遇见更好的自我
遇见更好的自我 2021-01-04 18:34

Is it true that whether the architecture is big or little endian ,only the memory layout of numbers differ,that of the string is the same.

4条回答
  •  灰色年华
    2021-01-04 18:51

    For the most part, but you should understand why. Big vs little endian refers to the ordering of bytes in multi-byte data types like integers. ASCII characters are just a single byte.

    Note however that unicode characters are multiple bytes, so the byte order matters. The entire point of unicode is that the single byte in ASCII can only encode 256 different values, which is not enough for all the languages in the world.

    Refer here for more informantion about what endianness means: http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Data/endian.html

提交回复
热议问题