Lecture 7: April 17, 2023

Reading: zyBooks, §6.5–6.13
Assignments: Homework 1 and Extra Credit 1, due April 24

  1. Announcements
    1. Warning: do not put int i in your for loop — declare it at the top of the function
    2. Go through scp

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

  3. 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]
    3. Scope: local variables [scope.c]

  4. Pointers and Arrays
    1. Arrays as pointers
    2. How indexing works
    3. Arrays as function parameters
    4. Multi-dimentional arrays

  5. Example: ptrstew.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 17, 2023 at 3:11PM

You can also obtain a PDF version of this.

Valid HTML 4.01 Transitional Built with BBEdit Built on a Macintosh