Previous Lecture lect12 Next Lecture

lect12, Tue 02/19

References, Pointers, Passing Parameters to functions, Structs

Readings for today’s lecture

Reading for next lecture

Today’s lecture focused on reviewing concepts from Lecture 11.

Slides were updated with the additional, hand-drawn diagrams to emphasize that the value of a pointer is an address (different from its own address).

Based on students’ requests on the course eval survey, homeworks are making a comeback: they will now be focused on what the exam will cover. The next homework is optional (see below) but the subsequent homeworks will earn you points, in addition to preparing you better for the exam.

Quizzes

HW 4

Update: Based on students’ requests we set up Gradescope to accept student submissions: you now have the option of uploading your submission yourself.

Lecture Notes:

Note: To change a function that takes arguments by copy / by value to a function that takes arguments by reference, just add the address-of operator (&) in front of the arugments in the function header. See slides for examples.

Pointers

Helful online visualization of C++ programs (may help to understand pointers): [http://pythontutor.com/cpp.html#mode=edit]

Structs