Outline for April 9, 2025

Reading: zyBook §2.20, 6.1–6.8
Due: Homework #1, due April 14, 2024


  1. Review of the CSIF and compiling

  2. Quick review
    1. signed vs. unsigned [unsigned.c]
    2. Type casting [cast.c]
    3. Overflow and types [mult.c]
    4. Increment and decrement [ppmm.c]

  3. Functions in C
    1. Parameters: pass (or call) by value [swap.c]
    2. Arguments: instantiations of parameters matched in order
    3. Return values
    4. Show the program stack and how it relates to functions

  4. Pointers and indirection
    1. A pointer is an address
    2. Declarations
    3. Address (&), dereference (*) operators
    4. Indirect references

  5. More on functions in C
    1. Parameters: pass (or call) by reference (also called output parameters)
    2. Example: swap function — exchange values of two variables (swap.c)

  6. Pointers and Arrays
    1. Arrays as pointers (pointer constants)
    2. How indexing works
    3. Arrays as function parameters
    4. Multi-dimensional arrays

  7. More on arrays
    1. Initializations
    2. Contrast with pointer initialization

  8. C arrays and strings
    1. String representation: array of chars terminated by NUL (ASCII ‘\0’)
    2. gets(buf), fgets(buf, size, fp) [bad.c, good.c]

UC Davis sigil
Matt Bishop
Office: 2209 Watershed Sciences
Phone: +1 (530) 752-8060
Email: mabishop@ucdavis.edu
ECS 36A, Programming & Problem Solving
Version of April 10, 2025 at 8:11AM

You can also obtain a PDF version of this.

Valid HTML 4.01 Transitional Built with BBEdit Built on a Macintosh