嵌入式软件工程师&&太极拳
全部博文(548)
分类:
2011-02-20 20:12:21
#includeint main(void) { int i, num, bit ,length; printf("please input num: "); scanf("%x", &num); printf("please input bit: "); scanf("%d", &bit); printf("please input length: "); scanf("%d", &length); i = ((1 << length) - 1) & (num >> (bit - length + 1)); printf("The bit is: %x \n", i); return 0; }