home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 17 / CD_ASCQ_17_101194.iso / dos / prg / alb_c10 / chap_03 / ch03_01.c next >
Encoding:
C/C++ Source or Header  |  1994-09-08  |  1.1 KB  |  37 lines

  1. /*********************************************************************
  2. *  CH03_01.C                 OpΘrateurs de manipulation de bits    *
  3. *********************************************************************/
  4.  
  5. #include<stdio.h>     
  6.  
  7. main( void)
  8. {
  9.     int t0= 0, t1= 32566, t2= 3855, t3= 4345, t4= 8250,
  10.     test0, test1, test2, test3, test4, test5, test6, test7, test8;
  11.  
  12.     test0= ~t0;        
  13.     test1= ~t1;        
  14.     test2= ~( -t1);
  15.  
  16.     test3= t2 & t3;        
  17.     test4= t2 | t3;
  18.     test5= t2 ^ t3;
  19.  
  20.     test6= t3<< 2;
  21.     test7= - t4<< 2;      /* l'opΘrateur - s'exΘcute avant << .
  22.                  mais l'Θcriture: test7= ( - t4)<< 2;
  23.                  lΦve toute ambiguitΘ            */
  24.     test8= t3>> 2;      
  25.  
  26.     printf(" test0= %d\t\t test1= %d\t\t test2= %d\n"
  27.            " test3= %d\t\t test4= %d\t\t test5= %d\n"
  28.        " test6= %d\t\t test7= %d\t\t test8= %d",
  29.        test0, test1, test2, test3, test4, test5,
  30.                            test6, test7, test8);
  31. }
  32.  
  33. /*
  34.  
  35.  test0= -1      test1= -32567         test2= 32565
  36.  test3= 9      test4= 8191        test5= 8182
  37.  test6= 17380     test7= 32536      test8=  1086            */