Question: Assume that you don't know what particular parameter passing style a programming language is using. In order to find out, you are asked to write

 Assume that you don't know what particular parameter passing style a

Assume that you don't know what particular parameter passing style a programming language is using. In order to find out, you are asked to write a short test program that will print a different output depending oil whether a call-by-value, call-by-reference, or call-by-value-result parameter passing style is used. Your test program must have the following form: program main() {a integer; procedure foo(integer x) {//statement body of foo}//statement body of main a = 1; call foo(a); print a;} The body of procedure foo must only contain assignment statements. For instance, you are not allowed to add any new variable declarations. Write the body of procedure foo such that print a in the main program will print different values for the different parameter passing styles. Give the output of your test program and explain why your solution works

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 Databases Questions!