Concept

How can the return value communicate errors when roots are passed by reference?

ComputerScienceOne / Quadratic Roots

"We also note that the return value in this case is unused since we are “returning” the root values in the two pass-by-reference variables. This frees up the return value to be used to communicate errors to the calling function. Recall that there could be several “bad” inputs to this function. The roots could be complex values, the coefficient a could be zero, etc. And now that we are dealing with pointers, the pointers could be invalid (point to NULL). In the next chapter, we examine how we can use the return value to communicate different errors to the calling function, letting it handle those errors."

Related Ideas

How can the return value communicate errors when roots are passed by reference? | ComputerScienceOne | Bifalgorithm | Bifalgorithm