Skip to main content

Defining Functions

  • Chapter
  • First Online:
Beginning C++20
  • 3124 Accesses

Abstract

Segmenting a program into manageable chunks of code is fundamental to programming in every language. A function is a basic building block in C++ programs. So far, every example has had one function, main(), and has typically used functions from the Standard Library. This chapter is all about defining your own functions with names that you choose.

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 54.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    If, for whatever reason, the operating system cannot determine the name that was used to invoke the program, argv[0] will be an empty string. This does not happen in normal use.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Ivor Horton and Peter Van Weert

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Horton, I., Van Weert, P. (2020). Defining Functions. In: Beginning C++20. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-5884-2_8

Download citation

Publish with us

Policies and ethics