int c = 8 << 2; printf("%d",c); what will be the output? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

int c = 8 << 2; printf("%d",c); what will be the output?

Can anyone explain with explanation.

18th Sep 2020, 1:46 AM
Ambika Kewat
3 Answers
+ 4
should be 32. 128 64 32 16 8 4 2 0 start at 8 and move left 2
18th Sep 2020, 1:50 AM
Slick
Slick - avatar
+ 4
c = 8<<2 c = 00001000<<2 =00100000=32 ⬅️ ↔️ printf("%d",c); //Output: 32 Just an explanation of Slick
18th Sep 2020, 3:23 AM
Jenson Y
+ 3
The << is bitwise operator. I suggest you check this. https://www.sololearn.com/learn/4087/?ref=app
18th Sep 2020, 2:11 AM
你知道規則,我也是
你知道規則,我也是 - avatar