Question

Explain why pass by value-result needs storage for both the value being passed AND the location...

Explain why pass by value-result needs storage for both the value being passed AND the location of the actual parameter being passed.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

pass by value-result is an implementation model for out-mode parameters.When a parameter is passed by result, no value is transmitted to the subprogram. The corresponding formal parameter acts as a local variable, but just before control is transferred, which obviously must be a variable (how would the caller reference the computed result if it were anything else?).If values are returned (as opposed to access paths), as they typically are, pass-by-result also requires the extra storage and the copy operations that are required by pass-by-value. As with pass-by-value, the complexity of implementing pass-by-result prevents transmitting an access path instead of a value.In this case, the problem is in ensuring that the initial value of the actual parameter is not used in the called subprogram.


pass by value-result is an implementation model for inout-mode parameters in which actual values are
moved.It is in effect a combination of pass-by-value and pass-by-result.The value of the actual parameter is used to initialize the corresponding formal parameter, which then acts as a local variable.In fact, pass-by-value-result
formal parameters must have local storage associated with the called subprogram.At subprogram termination, the value of the formal parameter is transmitted back to the actual parameter.

If the answer helped then please upvote, it means a lot.
And for any queries feel free to comment.

Add a comment
Know the answer?
Add Answer to:
Explain why pass by value-result needs storage for both the value being passed AND the location...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT