Script started on Wed Sep 17 17:27:58 2025 macbook:logs> cd ../programs/C_ch3 macbook:C_ch3> echo attend code: 7522 attend code: 7522 macbook:C_ch3> grep "10==9" *.c expr.c: a[i], (i%10==9||i==(n-1))?'E':'S'); // E for end, S for space expr.c: // a[i], (i%10==9||i==(n-1))?'\n':' '); macbook:C_ch3> cat expr.c /* expr1? expr2 : expr3 example (Unsure of source: Probably King's C book, chapter 3) */ #include int main () { int i; int a[] = { 23, 34, 45, 56, 67, 78, 89, 90, 01, 12, 4, 3, 2, 1 }; int n = 14; for (i=0; i gccc expr.c zsh: command not found: gccc macbook:C_ch3> gcc expr.c macbook:C_ch3> ./a.out 23 S 34 S 45 S 56 S 67 S 78 S 89 S 90 S 1 S 12 E 4 S 3 S 2 S 1 E% macbook:C_ch3> vi expr.c macbook:C_ch3> cat expr.c /* expr1? expr2 : expr3 example (Unsure of source: Probably King's C book, chapter 3) */ #include int main () { int i; int a[] = { 23, 34, 45, 56, 67, 78, 89, 90, 01, 12, 4, 3, 2, 1 }; int n = 14; for (i=0; i gcc expr.c macbook:C_ch3> ./a.out 23 34 45 56 67 78 89 90 1 12 4 3 2 1 macbook:C_ch3> vi Sept17_example.txt macbook:C_ch3> cp ../C_ch2/hello.c bitwise_AND.c macbook:C_ch3> vi bitwise_AND.c macbook:C_ch3> gcc bitwise_AND.c macbook:C_ch3> cat bitwise_AND.c /* bitwise_AND.c */ #include int main (int argc, char *argv[]) { int a = 3; int b = 6; int c; c = a & b; printf("%d & %d = %d\n", a, b, c); return 0; } macbook:C_ch3> ./a.out 3 & 6 = 2 macbook:C_ch3> cat Sept17_example.txt 3 = 0011 6 = 0110 & --------- 0010 macbook:C_ch3> vi bitwise_AND.c macbook:C_ch3> gcc bitwise_AND.c macbook:C_ch3> cat bitwise_AND.c /* bitwise_AND.c */ #include int main (int argc, char *argv[]) { int a = 3; int b = 6; int c; c = a & b; printf("%d & %d = %d\n", a, b, c); if (a && b) printf("a && b true\n"); else printf("a && b false\n"); return 0; } macbook:C_ch3> ./a.out 3 & 6 = 2 a && b true macbook:C_ch3> echo 1 is 0001, 2 is 0010 1 is 0001, 2 is 0010 macbook:C_ch3> vi Sept17_example_2.txt macbook:C_ch3> cat Sept17_example_2.txt OR truth table x y | x OR y ------------- 0 0 | 0 0 1 | 1 1 0 | 1 1 1 | 1 x = 1 = 0001 y = 2 = 0010 | (bitwise OR) ------ 0011 = 3 convert 0 0 1 1 to decimal 1x2^0 1x2^1 0x2^2 0x2^3 add these = 0x2^3 + 0x2^2 + 1x2^1 + 1x2^0 = 0 + 0 + 2 + 1 = 3 macbook:C_ch3> exit Saving session... ...copying shared history... ...saving history...truncating history files... ...completed. Deleting expired sessions...none found. Script done on Wed Sep 17 18:45:32 2025