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:

  2  2  2  2  2

 

 

Effects of passing array element by value:

 

The value of a[3] is 2

Value in modifyElement is 4

The value of a[3] is 2