81.9k views
3 votes
When a function needs access to an original argument passed to it, for example in order to change its value, the argument needs to be

User Libert
by
6.8k points

1 Answer

2 votes

Answer:

See explanation

Step-by-step explanation:

The question would be best answered if there are list of options.

However, the question is still answerable.

When there's a need to change the value of the argument passed into a function, what you do is that you first pass the argument into a parameter, then you change the value.

Take for instance, the following code segment:.

int changeArg(int n){

int newhange = n;

newhange++;

return newhange;

}

The above takes in n as the argument

Then it passes the value of n into a reference parameter, newchange

And lastly, the value is altered.

User Andrew Niefer
by
6.2k points