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.
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 ...