O'Reilly logo

Beginning C++ by Ivor Horton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 8

image

Defining Functions

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 that 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 to declare and define functions
  • How data is passed to a function and how a function can return a value
  • What “pass-by-value” means
  • How specifying a parameter ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required