无符号
请求无符号版本的整数类型的类型说明符。
- 单独使用时,暗示
int,因此unsigned与unsigned int的类型相同。 unsigned char的类型与char的类型不同,即使char是无符号的。它可以保持至少 255 的整数。unsigned也可以与short,long或long long结合使用。它不能与bool,wchar_t,char16_t或char32_t结合使用。
例:
char invert_case_table[256] = { ..., 'a', 'b', 'c', ..., 'A', 'B', 'C', ... };
char invert_case(char c) {
unsigned char index = c;
return invert_case_table[index];
// note: returning invert_case_table[c] directly does the
// wrong thing on implementations where char is a signed type
}