CS208, Monday 10 Jan 2022
Skills to be practicing
Unix
C
writing integers in binary, octal, and hexadecimal
Questions about Starting C assignment
Brief note on sizes
sizeof
sizeof(char *)
size_t
Queues in C assignment
Goals: pointers & error handling
Walk through the testing/building infrastructure
Code
make test
fix q_new, then rerun make test
./qtest to play with your code as you proceed
Advice
Get started right away
One function at a time, from the top
Check return value from malloc every time
Check parameters for NULL every time
Write "make_node" and "free_node" functions when you get to inserting and removing
Style issues
The original lab authors' naming style (yuck)
One-liner ifs, elses, whiles, etc.: still use braces!
Brace placement
Integers
want to practice your hexadecimal? here's your game: Flippy Bit and the Attack of the Hexadecimals From Base 16
binary is the real data, octal/decimal/hexadecimal for writing them more conveniently; an integer is an integer, no matter what notation you use to represent it
short, int, long
bytes of an int in memory
byte order, also known as "endianness"
Jonathan Swift's "Gulliver's Travels"
eggs, big-endians, and little-endians
big/little-endian integers
Negative integers
Signed magnitude
Two's complement