summaryrefslogtreecommitdiff
path: root/CSAPP/chap2/2_12.c
blob: b7f53ac5d1263f847ab3663508e16d2b7772c99f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#include <stdio.h>

int main (void) {
	int a = 0x87654321;

	printf("Ans A: 0x%.8x\n", (a & 0xff));
	printf("Ans B: 0x%.8x\n", ((~a) & ((~0) & ~0xff)) | (a & 0xff));
	printf("Ans B2: 0x%.8x\n", ((~0xff) & (~a)) |(a & 0xff));
	printf("Ans C: 0x%.8x\n", (a | 0xff));

	return 0;
}