Copyright ©2004 Pearson Addison-Wesley. All rights reserved.
Having arrays as function arguments
Besides passing individual array elements to functions, we can write functions that take entire arrays as arguments.
There are several ways of passing arrays to functions but in each case we only pass the .
This is very similar to what we did during “passing variables by reference…”
As we are not passing a copy of the array – any changes to the array made within the function will also effect the original array.
When an array name with no subscript appears in the argument list of a function call, what is actually stored in the function’s corresponding parameter is the address of the array. Example,
foo(&a); // same as above