CyberSlug Rules!

Beginner Programming CMPS060

Prof. Paulo Franca

Home

Syllabus

Login

Objects

Download

Staff only

Returning values in Functions

Functions that return values, can also be used in expressions;
the returned value will be used.

for example, if a function:

float height(float t)
{
return 0.5*32.18*t*t;
}
 

is defined, then a program can use an expression such as:

distance=10+height(time);
the computer will pass time as an argument, execute the function and use the returned value to add to 10.