0
#include <stdio.h> void main() { int x = 1, z = 3; int y = x << 3; printf(" %d\n", y); }
8 is the output but why??
3 Answers
+ 7
This is a binary operation and shift bits of x, 3 times left.
int x = 1 in binary looks ...0001.
After shifting 3 times left the binary looks ...01000 and this equals 8 in decimal.
+ 4
Try it out in the Code Playground ...