Skip to main content

Pointers

  • Chapter
  • First Online:
Guide to Scientific Computing in C++

Part of the book series: Undergraduate Topics in Computer Science ((UTICS))

  • 216k Accesses

Abstract

One of the key features of the C++ language is the concept of a pointer. As we demonstrate in this chapter, pointers are extremely useful for allocating memory for arrays whose sizes are not known when the code is compiled. We will see in the next chapter that they also have use when writing functions that allow us to repeat the same operation on different variables. Before we may use these features we first need to understand what a pointer is. This chapter therefore begins by introducing pointers through explaining how they relate to the storage of variables in the computer’s memory. We then explain how pointers may be used to dynamically allocate memory for arrays whose sizes are unknown at compile time, before briefly discussing some features of pointers that have been introduced in recent C++ standards.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    At the time of writing the second edition of this book the relevant specifications are C++11, C++14 and C++17.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Joe Pitt-Francis .

Rights and permissions

Reprints and permissions

Copyright information

© 2017 Springer International Publishing AG, part of Springer Nature

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Pitt-Francis, J., Whiteley, J. (2017). Pointers. In: Guide to Scientific Computing in C++. Undergraduate Topics in Computer Science. Springer, Cham. https://doi.org/10.1007/978-3-319-73132-2_4

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-73132-2_4

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-73131-5

  • Online ISBN: 978-3-319-73132-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics