Here is a complete function that purports to return one of the roots of a quadratic given suitable parameters. It looks good, but fails to compile. Why?
```
//returns one of the roots of the quadratic equation
//a*x*x + b*x + c = 0 a!= 0
double root1 (double a, double b, double c)
{
return (-b + sqrt(b*b-4*a*c))/(2*a);
```
The function sqrt, called in the body of the function root1, has no declaration
(or prototype) given. The rest of the code is correct. The following preprocessor
directive is needed prior to the definition of the function root to get a declaration of
sqrt.
#include
Some systems will create a declaration of an un-type-checked function, to allow
the compiler to find other errors. The user is warned, but linking usually fails in
this event.
You might also like to view...
What are some of the commonly used PictureBox properties and the default event for a PictureBox?
What will be an ideal response?
?Choose the correct pronoun in the following sentence.Ed sent Brione and __________ a list of people to invite.
A. ?her B. ?she