Write a function change that accepts an int array as the first parameter, and another int parameter for the length of that array and an int value as a third parameter. The function will store the integer value into the last element of the array. The original array SHOULD change. As an example, given the array int x = {5, 4, 9, 42};
The following call to your function change
change(x, 4, 14);
should change the value of the last element of the array to 14.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <iostream>
usingnamespace std;
int change(int x[],int length,int *value);
int main()
{
int i;
int x[i];
change(x,4,14);
}
int change(int x[],int length,int *value)
{
x[length-1]=&value;
return x[];
}
I'm getting "invalid conversion from int to int*". I know my code is wrong but I have no idea where to go from here. Can anyone help?