Left Shift and Right Shift Operators in C
Can someone please explain the concept of Left and Right shift operators? How do we deal with binary in this?
- 6529 दृश्य
- 2 उत्तर
There are two shift operators in C programming: 1)Right shift operator 2)Left shift operator. Right Shift Operator (>>) Right shift operator shifts all bits towards the right by a certain number of specified bits. It is denoted by >>. 200 = 11001000 200>>1 = 01100100 [Right shift by one bit] 200>>2 = 00110010 [Right shift by two bits] 200>>5 = 00000110 [Right shift by five bits] Left Shift Operator (<<) Left shift operator shifts all bits towards left by a certain number of specified bits. It is denoted by <<. 200 = 11001000 200<<1 = 110010000 [Left shift by one bit] 200<<4 = 110010000000 [Left shift by four bit] For more information visit:- https://www.knowprogram.com/c-programming/bitwise-operators-in-c/#Right%20Shift
-
- 03 मई
- 0 टिप्पणी