c语言点点滴滴


位与运算: 
 
#include <stdio.h>

void main (){
   printf("0 & 0 is %d\n", 0 & 0);
   printf("0 & 1 is %d\n", 0 & 1);
   printf("1 & 1 is %d\n", 1 & 1);
   printf("1 & 2 is %d\n", 1 & 2);
   printf("15 & 127 is %d\n", 15 & 127);
 
0 & 0 is 0
0 & 1 is 0
1 & 1 is 1
1 & 2 is 0
15 & 127 is 15
 
 
位取反: 
 
#include <stdio.h>//inverse  翻转;相反;颠倒的//位反运算符void main ()
 {
   int value = 0xFF;
   printf("The inverse of int value 0Xff is %X\n", value, ~value);
   printf("The inverse of %X is %X\n", value, ~value);
 }
 
The inverse of int value 0Xff is FF
The inverse of FF is FFFFFF00
 
 
posted @ 2013-06-01 23:06  hark.perfe  阅读(155)  评论(0编辑  收藏  举报