Question: 8 . 7 . 3 : Functions with array parameters. int arrToModify [ MAX _ SIZE ] ; / / allow at most 2 0

8.7.3: Functions with array parameters. int arrToModify[MAX_SIZE]; // allow at most 20 elements
int numVals;
int i;
cin >> numVals;
for (i =0; i numVals; ++i){
cin \gg> arrToModify[i];
}
cout "Input: ";
PrintArr(arrToModify, numVals);
ResetLastValue(arrToModify, numVals);
cout "Output: ";
PrintArr(arrToModify, numVals);
601270.4120114.qx3zqy7
Jump to level 1
Integer numVals is read from input, representing the number of remaining values in the input. Then, numVals integers are read
from input and stored into the array arrToModify. Write a function ResetLastValue() that takes an integer array parameter and an
integer parameter for the number of elements in the array, and replaces the last element with 1.
Ex: If the input is:
6
145,120,95,40,100,125
then the output is:
Input: 145,120,95,40,100,125
Output: 145120,95,40,1001
#include
8 . 7 . 3 : Functions with array parameters. int

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!