How do I specify an integer literal of type unsigned char in C++?

前端 未结 9 1665
灰色年华
灰色年华 2020-12-08 18:38

I can specify an integer literal of type unsigned long as follows:

const unsigned long example = 9UL;

How do I do likewise for an unsigned

9条回答
  •  盖世英雄少女心
    2020-12-08 18:51

    There is no suffix for unsigned char types. Integer constants are either int or long (signed or unsigned) and in C99 long long. You can use the plain 'U' suffix without worry as long as the value is within the valid range of unsigned chars.

提交回复
热议问题