Pointers & References

Lessons in this group, roughly in build order:

  • pointers — A pointer is a variable whose value is the memory address of another object, letting you read or mutate…
  • references — A reference is an alias — a second name bound to an existing object — that you use with ordinary syntax,…
  • pointer-arithmetic — Pointer arithmetic moves a pointer across an array in element units, scaling integer offsets by sizeof(T)…
  • nullptr — nullptr is the typed null-pointer literal (C++11), a std::nullptr_t value that converts to any pointer…
  • const-pointers-pointer-to-const — const on a pointer can lock either the pointee (you can’t write through it) or the pointer itself (you…
  • smart-pointers-unique-ptr-shared-ptr-weak-ptr — Smart pointers are raii wrappers in that own a heap object and free it automatically, encoding…
  • dangling-pointers-memory-leaks — These are the two opposite failures of manual memory: a dangling pointer outlives its object (freed too…