© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2023
I. Horton, P. Van WeertBeginning C++23https://doi.org/10.1007/978-1-4842-9343-0_8

8. Defining Functions

Ivor Horton1   and Peter Van Weert2
(1)
Stratford-upon-Avon, Warwickshire, UK
(2)
Kessel-Lo, Belgium
 

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.

In this chapter, you will learn
  • What a function is and why you should segment your programs into functions

  • How ...

Get Beginning C++23: From Beginner to Pro 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.