Please explain

This code prints 32 at the output but can you please tell me how it is 32??

printf("%d", 2<<6>>2);
Last edited on
The bitshift operators. Check them out.
1
2
3
4
5
6
7
8
9
10
11
12
00000010   <-  2 in binary

00000100   <-  left shift 1
00001000   <-  left shift 2
00010000   <-  left shift 3
00100000   <-  left shift 4
01000000   <-  left shift 5
10000000   <-  left shift 6

00100000   <-  right shift 2

00100000   <-  32 in binary
@Disch Thanks bro..I was stupidly calculating 2 bitshifts at the same time..Marking it as solved..:)
Last edited on
Topic archived. No new replies allowed.