CS208 Introduction to Computer Systems Friday, 3 April 2026 + Quiz on Monday, April 6 - bitwise operators (|, &, ~, ^) - numbers will be represented as hexadecimal - Example question: Given 8-bit numbers a = 0xE5 and b = 0x3C, express ~a, a&b, and a|b as 2-digit hexadecimal numbers. + Today: miscellaneous stuff + LAB items - worth a few points (between 2 and (rarely) 5; compare to quizzes 2-3) - due the day we do them in class - "good-faith effort" scoring + Bitwise operators - <<, >>, multiplication, and division - what makes "print_integer_in_binary" tricky - two strategies - "turning on bit N", "turning off bit N" - "masking out a portion of an int" + Today's assignment questions + Misc - remember this, which often applies: "you can just try it and see what happens" (of course, you want to follow that up with "why?") - assert - byte-counter.c and its more complicated pal + Monday's assignment + Null-terminated strings in C - the idea - what's this "char *" thing? + Coming up - negative integers - characters: ASCII, Unicode, UTF-8, UTF-16 - (try to find half a day for float--i.e., real numbers) - more on strings ===== #include int main() { int a = 0xE5; int b = 0x3C; printf("0x%x\n", a | b); printf("0x%x\n", a & b); printf("0x%x\n", a ^ b); printf("0x%x\n", ~a); return 0; }