6.5 Function-Prototype and Argument-Coercion Notes

A function prototype is required unless the function is defined before it’s used. When you use a standard library function like sqrt, you do not have access to the function’s definition, therefore it cannot be defined in your code before you call the function. Instead, you must include its corresponding header (<cmath>), which contains the function’s prototype.

Common Programming Error 6.3

If a function is defined before it’s called, then its definition also serves as the function’s prototype, so a separate prototype is unnecessary. If a function is called before it’s defined, and that function ...

Get C++ How to Program, 10/e 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.