Is char signed or unsigned by default?

前端 未结 7 816
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-21 06:49

In the book \"Complete Reference of C\" it is mentioned that char is by default unsigned.

But I am trying to verify this with GCC as well as Visual Stud

7条回答
  •  梦毁少年i
    2020-11-21 07:13

    According to "The C++ Programming Language" by Bjarne Stroustrup, char is "implementation defined". It can be signed char or unsigned char depending on implementation. You can check whether char is signed or not by using std::numeric_limits::is_signed.

提交回复
热议问题