Arrays as Reference Parameters

This is a better declaration for a function that will add two arrays together:
void addArrays(const int firstArray[], 
               const int secondArray[], 
               int resultArray[], 
               int sizeOfArray);
Notice the const keyword. It tells the compiler that any attempt to modify the array elements within the addArrays(...) function should be prohibited.

Previous page
Next page

Back to Lesson 11 Index
Back to Outline