Complete the code to left shift the number 1 by 3 positions.
int result = 1 [1] 3; printf("%d\n", result);
The left shift operator << moves bits to the left, multiplying the number by 2 for each shift.
Complete the code to right shift the number 16 by 2 positions.
int result = 16 [1] 2; printf("%d\n", result);
The right shift operator >> moves bits to the right, dividing the number by 2 for each shift.
Fix the error in the code to correctly left shift the variable x by 4.
int x = 2; int y = x [1] 4; printf("%d\n", y);
To left shift the value of x by 4 bits, use the << operator.
Fill both blanks to create a dictionary-like structure using bit shifts: shift 1 left by 5 and shift 32 right by 3.
int a = 1 [1] 5; int b = 32 [2] 3; printf("%d %d\n", a, b);
Use left shift << to multiply by powers of two, and right shift >> to divide by powers of two.
Fill all three blanks to compute: shift x left by 2, y right by 1, and add z.
int x = 3, y = 8, z = 5; int result = (x [1] 2) + (y [2] 1) + [3]; printf("%d\n", result);
Shift x left by 2 bits, shift y right by 1 bit, then add z.