Videos: C, Numbers, and Data Representation
slides: c+representation.pdf |
These videos about C, pointers, and number representations should be mostly review, but they touch on things that will be important specifically for this course. Most days won’t have so many vidoes as this review.
- How to compile an run simple C programs, including the way that Unix programs report success and failure.In the videos, I use Emacs as a text editor. There are many good choices for editors. You can also use clang as the C compiler instead of gcc, but we will use gcc to compile and run your assignments.
- C variables and their addresses, leading up to pointers.
- Creating, reading from, and writing to pointers.
- Arrays in C, and how they relate to pointers.
- Strings are arrays of characters terminated with a 0 byte. Arrays of arrays of strings are relevant for handling command-line arguments.
- How and why adding to a pointer changes the address in a type-specific way.
- A brief note on for loops and functions in C.
- Signed an unsigned integers at various sizes.The slides in the video include an obvious typo: int has 32 bits, not 16. The slides are corrected in PDF form.
- C operations for booleans and for manipulating the bits of an integer.The video omits the ^ bitwise “XOR” (for “exlcusive or”) operator, but an example has been added to the PDF slides at page 49-50.
- Arithmetic overflow, coercions between sizes and signs, and the C specification.
- IEEE-standard encoding of floating-point numbers.Here’s the key summary slide by itself: floating-point quick reference.
- Trying out the results from the previous video on some example bit patterns.You should be able to perform this kind of decoding on a quiz or exam, especially for small values of k and n.
- Strings, again, but also some examples of viewing bits as various types through casts and copies.
- Some terminology and guidance about integer sizes according to C standards and in practice.
- Examples of common ways to be confused about floating-point numbers, integer arithmetic, pointers, and compiler-optimization modes.