Defining Functions

Before you can use a function, you must first define the function header and then the function body.

A function header definition consists of the function's return type, name, and argument list. Figure 7.2 illustrates the parts of the function header.

Figure 7.2. Parts of a function header.

Parameters or Arguments?

The values passed to a function are its arguments. Arguments come in two flavors: formal (in the function header) and actual (in the function call). Formal arguments are also called parameters. Actual arguments are the ...

Get SAMS Teach Yourself C++ in 10 Minutes SECOND EDITION 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.