Help please
Hi can someone please help me,
I have got this code below and I do not know what the "<<" and the ">>" operators functionalities are. The code is basically; Code:
unsigned long nn, m, n; Adam 
Re: Help please
Please read about the proper way to post code. The operators you show are binary shift operators. In the first line the binary value, 512, is being shifted left one bit. This results in a value of 1024. In the second line, the value of n (now 1024) is being shifted right one bit. This results in the original value, 512. The third line is merely shorthand for "m = m >> 1;", which results in the value 256.
In a left shift, the rightmost bit becomes a 0. In a right shift, the leftmost bit becomes a zero for unsigned variables, or a duplicate of its previous (before the shift) value for signed variables. 
Re: Help please
These are Bit wise shifting operators that shift bits of the variable provided on left hand side of << / >> , number of times provided on right hand side of operators. by discarding the carry bits......

Re: Help please
Thanks for clearing that up.

All times are GMT +5.5. The time now is 21:08. 