The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+1 vote
280 views

What type of parameter passing mechanism (call-by-value, call-by-reference, call-by-name, or-by-value result) is the following sequence of actions trying to implement for a procedure call $P (A[i])$ where P (i:integer) is a procedure and A is an integer array?

Is the implementation correct? Explain and correct it if necessary. You are supposed to make only small changes

  1. Create a new local variable, say z.
  2. Assign to z the value of A[i].
  3. Execute the body of P using z for A[i]
  4. Set A[i] to z.​

asked in Programming by Veteran (59.5k points) | 280 views

1 Answer

+2 votes

implement the call by value result parameter passing technique 
as value is first copied
all changes done in local variable
and then again value copied in actual variable

answered by (193 points)

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

39,437 questions
46,622 answers
139,356 comments
57,007 users