initial import
[staff/goc4/2018bti7061.git] / c-3-libraries / examples / c-lowlevel / shift.c
1 #include <stdio.h>
2
3
4 int main(){
5 puts("Shift to the left 3 bits");
6 unsigned int a = 0xFF00;
7 unsigned int b = a << 3;
8 printf("a=%X; b=%X\n",a,b);
9
10 puts("Shift to the right 3 bits");
11 unsigned int a2 = 0xFF00;
12 unsigned int b2 = a >> 3;
13 printf("a2=%X; b2=%X\n",a2,b2);
14
15 putchar('\n');
16 puts("Shift to the left 4 bits");
17 a = 0xFF00;
18 b = a << 4;
19 printf("a=%X; b=%X\n",a,b);
20
21 puts("Shift to the right 4 bits");
22 a2 = 0xFF00;
23 b2 = a >> 4;
24 printf("a2=%X; b2=%X\n",a2,b2);
25
26
27 }