隐式类型提升规则
这篇文章是用来作为关于C中的隐式整数提升的常见问题,特别是由通常的算术转换和/或整数提升引起的隐式提升。
unsigned char x = 0;unsigned char y = 1;printf("%u\n", x - y);
unsigned int a = 1;signed int b = -2;if(a + b > 0) puts("-1 is larger than 0");
short
unsigned short a = 1;signed short b = -2;if(a + b > 0) puts("-1 is larger than 0"); // will not print
相关分类