解出以下列印結果:
unsigned int a = 0;
unsigned int b = 1;
unsigned int c = -1;
unsigned int d = 4294967295;
unsigned int e = 4294967294;
unsigned int f = 0;
f = a-b;
printf( "a-b = %d
", f );
printf( "c = %d
", c );
f = a-d;
printf( "a-d = %d
", f );
f = b-d;
printf( "b-d = %d
", f );
printf( "d = %d
", d );
f = d+1;
printf( "d+1 = %d
", f );
f = d-1;
printf( "d-1 = %d
", f );
printf( "e = %d
", e );
f = e-d;
printf( "e-d = %d
", f );
f = d-e;
printf( "d-e = %d
", f );
~~~~~~~~~~~
解出來了嗎?
讓我們看一下正確答案:
a-b = -1
c = -1
a-d = 1
b-d = 2
d = -1
d+1 = 0
d-1 = -2
e = -2
e-d = -1
d-e = 1
註記:
int 範圍 -2,147,483,648 ~ 2,147,483,647
unsigned int 範圍 0 ~ 4,294,967,295