Next: Function Prototyping Up: Functions Previous: void functions

Functions and Arrays

Single dimensional arrays can be passed to functions as follows:-

Here the declaration float list[] tells C that list is an array of float. Note we do not specify the dimension of the array when it is a parameter of a function.

Multi-dimensional arrays can be passed to functions as follows:

Here float table[][5] tells C that table is an array of dimension N5 of float. Note we must specify the second (and subsequent) dimension of the array BUT not the first dimension.


Dave.Marshall@cm.cf.ac.uk
Fri May 20 13:40:49 BST 1994