1.signed和unsigned
signed和unsigned关键字修饰 char short int long 等整型家族的类型
signed表示一个类型带正负号,包含负值
unsigned表示该类型不带正负号,只能表0和正整数
char
[signed] char
unsigned char
//短整型
short[int]
[signed] short[int]
unsigned short[int]
//整型
int
[signed] int
unsigned int
//长整型
long[int]
[signed] long [int]
unsigned long [int]
//更长的整型
long long [int]
[signed] long long [int]
unsigned long long [int]
signed 有符号的 可省略
2.int类型
int等同于signed int
signed int a;//有符号整数的输入输出格式是%d
unsigned int 可写成unsigned(别写
unsigned int a;//无符号整数的输入输出格式是%u
16位的短整型 signed short int 取值范围:-32768~32767(mc附魔等级最高值)
unsigned short int取值范围:0~65535
3.特殊的char类型
char返回字符的ASCII码
signed char c;//范围-128~127
unsigned char c;//范围0~255
char不等同于signed char,查类型默认是否带有正负号,由当前系统决定(编译器影响cahr默认正负)