Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
A function is a piece of code that performs a specific
general task with as little information as possible ( Why would you want this? Go to this page to view
the purpose of using functions).
A function declaration states what a function needs and returns.
A function definition states how a function uses its arguments
and calculates what to return.
Note
that main is a special function.
If
the data type the function
works on, consider making it a template
function.
Consider
using proper function design.
Avoid
long functions [0].
* WikiPedia's
page about functions
[0]
Herb
Sutter, Andrei Alexandrescu. C++ coding standards: 101 rules, guidelines, and best
practices. ISBN: 0-32-111358-6. Item 20: 'Avoid long functions. Avoid deep
nesting'.
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.