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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.