8 Pointers

Objectives

In this chapter you’ll:

  • Learn what pointers are.

  • Declare and initialize pointers.

  • Use the address (&) and indirection (*) pointer operators.

  • Learn the similarities and differences between pointers and references.

  • Use pointers to pass arguments to functions by reference.

  • Use built-in arrays.

  • Use const with pointers.

  • Use operator sizeof to determine the number of bytes that store a value of a particular type.

  • Understand pointer expressions and pointer arithmetic.

  • Understand the close relationships between pointers and built-in arrays.

  • Use pointer-based strings.

  • Use C++11 capabilities, including nullptr and Standard Library functions begin and end.

Get C++ How to Program, 10/e now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.