How this is true? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How this is true?

I got a question in a challenge in c++, it's confusing . question is, what is the output of this code: Cout<<(1<<1) Answer was 2

11th Apr 2019, 4:56 AM
Prashant Kumar
Prashant Kumar - avatar
2 Answers
+ 2
x<<y = x*(2^y) 1<<1 = 1*(2^1) = 2
11th Apr 2019, 8:16 AM
Seb TheS
Seb TheS - avatar