56
|
56
|
Functions in programming languages are similar. A function has a series of instructions that take the assigned values as parameters and perform a certain task. In C++ and other programming languages, functions return only one result, as it happens in mathematics. The only difference is that a *programming* function could possibly not return any value (in this case the function is declared as `void`). If the function will return a value, we use the instruction `return`. As in math that you need to specify the domain and range, in programming you need to specify the types of values that the function's parameters and result will have; this is done when declaring the function.
|