Chapter 2 : 信息的表示和处理 - 习题 (2)
勘误
P68
P73
2.27
int uadd_ok(unsigned x, unsigned y) {
unsigned sum = x + y;
return sum >= x;
}
2.28
int tadd_ok(int x, int y) {
int sum = x + y;
if (x > 0 && y > 0 && sum < 0) return 0;
if (x < 0 && y < 0 && sum > 0) return 0;
return 1;
}