Effects of passing entire array by reference:

 

The values of the original array are:

  0  1  2  3  4

The values of the modified array are:

  0  2  4  6  8

 

 

Effects of passing array element by value:

 

The value of a[3] is 6

Value in modifyElement is 2

The value of a[3] is 6