-4
初學C(系統)
include <stdio.h>
int main() {
int n1 = -1;
int n2 = 2;
unsigned int u1 = (unsigned int) n1;
unsigned int u2 = (unsigned int) n2;
int result = (n1 < n2) == (-n1 > -n2);
print f("(%d < %d) == (-%d > -%d) evaluates to %d\n", n1, n2, n1, n2, result);
/*question 1
Is result always 1 (true)?
*/
result = ~n1 + ~n2 == ~(n1 + n2);
printf("(~%d + ~%d) == ~(%d + %d) evaluates to %d\n", n1, n2, n1, n2, result);
return 0;
/*question 1
Is result always 0(false)?
*/
}
我沒有得到什麼概念#1試圖展示,但我認爲#2基本上詢問是否在分發〜情況。結果總是0嗎?解釋