-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathascii.c
58 lines (50 loc) · 950 Bytes
/
ascii.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* =======================================================================
*
* Filename: ascii.c
*
* Description: Test program for various things as I learn of them.
*
* Author: Jason Manning (ERiS), [email protected]
*
* =======================================================================
*/
#include <stdio.h>
int main(int argc, const char *argv[])
{
// Playing with bitoperations
int b = 7;
printf("%i ", b);
b = b << 1;
printf("%i ", b);
b = b << 1;
printf("%i ", b);
b = b << 1;
printf("%i ", b);
if(7 & 1)
printf("111 1");
if(4 & 1)
printf("100 1");
if(2 & 1)
printf("10 1");
printf("\n");
if(0)
printf("0");
if(1)
printf("1");
if(2)
printf("2");
printf("\n");
if(7 & 7)
printf("111 111\n");
if(4 & 4)
printf("100 100\n");
if(3 & 5)
printf("011 101\n");
if(1 & 4)
printf("001 100\n");
if(4 & 5)
printf("100 101\n");
b = 1 & 4;
printf("%i", b);
}