0011223344
here shift operator shifts the data by k bits (here 1 bit)
in binary shifting by 2 means divison by 2.
so ,for i=0;i/2=0
for i=1,i/2=0
for i=2,i/2=1
for i=3,i/2=1
for i=4,i/2=2 i=00000100 -> i>>1 -> 00000010 i.e. 2
i=10 i=00001010 i>>1 00000101 i.er 5.
for 2nd ,
i &1 ANDS 00000000 AND 00000001 so answer is 00000000
here there is bitwise AND.
so for any i whose LSB is 1 will be anded as XXXXXXX1 AND 00000001
and give o/p 1.
for
printf("%d",i&&1);
you get 011111111 and output where you check if first operand of AND is zero or not.so this is not a bitwise AND.
always remeber bitwise shift never ever modifies your orignal data