left shift and right shift operators ??

Ravi ravee_26@yahoo.com
Mon Jun 18 23:35:00 GMT 2001


Hi,
    I am new to the C language. I would like to know  what is the practical 
use of left shift  "<<"  and  right shift  ">>" operators. 

Another doubt is how do I predict what i get when i write a code like say :

  int  x = 25;
  printf("%d", x << 8 );

What does the compiler do ? does it convert the integer 25 into a binary 
number and shift it left by 8 bits ?  And what is the practical use of writing 
such a code ?

This left shift and right shift operator business is very confusing. I have 
read a few text books but I have not been able to clear my doubt.

Help is most appreciated.

Thanks in advance.



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




More information about the Gcc-help mailing list