#include using namespace std; // the print_array() is a "general-purpose function" // to print all values of an array void print_array( int a[], int length ) { for ( int i = 0 ; i < length ; i++ ) { cout << a[i] << ' '; } cout << endl; } // the array_add() function adds x to each element // of the given array // when we use int[], the values in the array // can be changed in the function (i.e. we'll see // those changes back in main()) void array_add( int a[], int length, int x ) { for ( int i = 0 ; i < length ; i++ ) { a[i] += x; } } int main() { const int ARRAY_SIZE = 5; int numbers[ ARRAY_SIZE ] = { 4, 6, 8, 9, 11 }; print_array( numbers, ARRAY_SIZE ); array_add( numbers, ARRAY_SIZE, 10 ); print_array( numbers, ARRAY_SIZE ); return 0; }