CS 70

Group 4: References and Pointers

  • LHS Cow speaking

    This group of topics relate to understanding how references and pointers works in C++.

  • RHS Cow speaking

    References, pointers, and the differences between them are the source of a lot of bugs in complex C++ programs. Understanding them now will help avoid lots of trouble later. Additionally, understanding how the code we write uses a computer's memory is important for every programming language you use!

Topics

You will know that you have achieved this group of learning objectives when you are able to

  • Goal 4A: References:
    • Read, write, and visualize C++ code involving references.
  • Goal 4B: Pointers:
    • Read, write, and visualize C++ code involving:
      • Pointers
      • The indirection operator (*)
      • The index operator ([])
      • The address-of operator (&)
      • new, and delete.
  • Goal 4C: Memory Management:
    • Recognize memory management issues, specifically:
      • Memory leaks
      • Double deletes
      • Dangling pointers.
    • Correct these issues.
  • Goal 4D: Reading Types:
    • Use the inside-out rule to read, write, and use complicated C++ types involving pointers, references, arrays, and const.

Need More Practice?

This group of goals are addressed in the following places:

There is even more in this lesson, which is great for practice for second tries but not needed to when taking the first try:

(When logged in, completion status appears here.)