+ 1

What is << operation in c++????

Explain shiftwise

30th Nov 2019, 4:28 PM
Sachin Shah
Sachin Shah - avatar
6 Respostas
+ 7
Sachin Shah I think you are asking about left shift and right shift operators. So consider this example- int a = 8; // Now write it's binary representation which is- 00001000 --> This is 8. a>>1 shifts every digit to right by 1 place. So it becomes- 00000100 --> This is 4. a<<1 shifts every digit to left by 1 place. So it becomes- 00010000 --> This is 16.
30th Nov 2019, 4:59 PM
Avinesh
Avinesh - avatar
+ 10
• Multiply by a power of 2 x = x << 1; // x = x * 2 x = x << 6; // x = x * 64 • Divide by a power of 2 x = x >> 1; // x = x / 2 x = x >> 3; // x = x / 8 • https://www.sololearn.com/learn/4087/?ref=apphttps://www.sololearn.com/learn/4086/?ref=apphttps://code.sololearn.com/cRRF49cpSTq7/?ref=app
30th Nov 2019, 10:17 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 5
Sachin Shah This question is missing things. Such as a explicate description. Which makes it challenging to answer. https://www.sololearn.com/discuss/1316935/?ref=app https://www.sololearn.com/discuss/333866/?ref=app
30th Nov 2019, 4:33 PM
Manual
Manual - avatar
+ 2
Its not only used in c++ you can also use it in C or Java for example
30th Nov 2019, 6:03 PM
Jnn
Jnn - avatar
+ 2
Thank you
30th Nov 2019, 11:02 PM
Tom penyikie
Tom penyikie - avatar
0
Manual thanks dude
30th Nov 2019, 4:36 PM
Sachin Shah
Sachin Shah - avatar