[prev] 65 [next]

Arrays and Functions

When an array is passed as a parameter to a function
  • the address of the start of the array is actually passed

    an exception to the 'call-by-value' parameter passing in C!

Example:

int total, vec[20];
…
total = sum(vec);

Within the function …

  • the types of elements in the array are known
  • the size of the array is unknown