Declaring and Defining Functions

Before you can call a function, you must first declare the function and then define the function.

The function declaration tells the compiler the name, return type, and types of the parameters of the function. The declaration of a function is called its prototype.

The definition tells the compiler how the function works. No function can be called from any other function unless the called function has first been declared.

Declaring the Function

The built-in functions supplied by your compiler vendor will have their ...

Get Sams Teach Yourself C++ in 24 Hours, Third 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.