- a, b, c 均是 32-bit 的整數 (signed integer)
- a = 2147483647
- b = -2147483648
- c = b - a = 1
- 十進位表示:
c(1) = b(-2147483648) - a(2147483647) - 十六進位表示:
c(0x00000001) = b(0x80000000) - a(0x7FFFFFFF)
以下是對映的 C 程式:
void main(void)
{
int32_t a;
int32_t b;
int32_t c;
a = 0x7FFFFFFF;
printf ("a(%d)\n", a);
b = a+1;
printf ("b(%d)\n", b);
c = b - a;
printf ("c(%d) = b(%d) - a(%d)\n", c, b, a);
printf ("c(0x%08X) = b(0x%08X) - a(0x%08X)\n", c, b, a);
}