Why 256 for a signed char is undefined in C++

后端 未结 6 435
Happy的楠姐
Happy的楠姐 2020-12-20 03:30

Reading the C++ Primer 5th edition book, I noticed that a signed char with a value of 256 is undefined. I decided to try that, and I saw that

6条回答
  •  有刺的猬
    2020-12-20 04:13

    unsigned char values is (to be pedantic, usually) is from 0 to 255. There is 256 values, that 1 byte may hold.

    If you get overflow (usually) values are used modulo 256, as other Integer type modulo MAX + 1

提交回复
热议问题