+ 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