Say your input is integer a (4 bytes) and you want set the bits from 4 to 7 then you need to do bitwise OR with a number which has 1 at those bits and 0 as remaining bits;
a = a | 0x00000074 // 0x74 is 01111000 in binary.
//C Program for setting of bits in one byte from 7 to 4 bits with 5 without changing remaing values num=num|1<<4; num=num&~(1<<5); num=num|1<<6; num=num&~(1<<7); printf("%d",num);
Say you are given "Hello World" Output should be "olleH dlroW"
How to swap ith and jth Bits for a 32-Bit Integer?
* * * * * * * * * * * * * * * * * * *
I above Ouput I Missed two stars.My question is how to find out the remaining stars.Please tel me in the C programming way.