Concept

How do C functions return values to the calling function?

ComputerScienceOne / Void Functions

"18.1. Defining & Using Functions\n\ndouble getDistance(double x1, double y1, double x2, double y2) {\n\ndouble xDiff = (x1-x2);\n\ndouble yDiff = (y1-y2);\n\nreturn sqrt( xDiff * xDiff + yDiff * yDiff);\n\n}\n\ndouble getMonthlyPayment(double principle, double apr, int terms) {\n\ndouble rate = (apr / 12.0);\n\ndouble payment = (principle * rate) / (1-pow(1+rate, -terms));\n\nreturn payment;\n\n}\n\nThe keyword return is used to specify the value that is returned to the calling function."

Related Ideas

How do C functions return values to the calling function? | ComputerScienceOne | Bifalgorithm | Bifalgorithm