netoops blog

Saturday, 24 August 2013

Bitwise_Operator

Void main()
{
char ch = 37;
printf ("\n%d",ch);
ch = ~ch;
printf ("\n%d",ch);

char ch = 127;
printf ("\n%d",ch);
ch = ch << 1;
printf ("\n%d",ch);
ch = ch << 3;
printf ("\n%d",ch);

     char ch = 127;
printf ("\n%d",ch);
ch = ch >> 1;
printf ("\n%d",ch);
ch = ch >> 3;
printf ("\n%d",ch);

 /* OR OPERATOR */
char ch = 82;
printf ("%d\n",ch);
  /* SET BIT 4th */
ch = ch | 8;
printf ("%d\n",ch);

 /* AND OPERATOR */
     char ch = 82;
printf ("\n%d",ch);
/* TEST 5th BIT */
if ((ch & 16) == 16)
printf ("\n5th BIT ON");
else
printf ("\n5th BIT OFF");
if ((ch & 4) == 4)
printf ("\n3rd BIT ON");
else
printf ("\n3rd BIT OFF");

 
       /* TURNING OF 7th BIT */
ch = ch & 191;
printf ("\n%d",ch);

getch();
}

Tech Knowledege
SOCIALIZE IT →
FOLLOW US →
SHARE IT →

0 comments :

Post a Comment

 
Subscribe For Free Updates!

We'll not spam mate! We promise.

Become Our Fan on Social Sites!