Might expand on this one day.
P.S. main() is a function.
Declaration.
Just like variables, all functions have to be
declared before use. Here is an
example.
int add( int, int);This statement declares a function called add, it has two integer arguments and returns an integer.
C++ has a nice feature called
reference variables
which is a tider
approch to modifing the contents of a passed variable.
Here is an example
The contents of 'c' are copied into 'i'.
Passing Arrays.
Variable number of parms (...)
Function recurssion.
Returning values.
Normally you would return an 'int', 'char', 'float', or 'double' using this
technic. The obvious time to return a value would be to return a completion
code.
Returning pointers.
Returning values is OK for the data types above but not very practical for
'char *' or structures. For these data types passing pointers can be more
appropriate. When using these pointers it is important to understand the
'static' storage class
otherwise you are going to get some unpredictable
results.
Top
Master Index
Keywords
Functions
Martin Leslie