Question: Problem 4- Parameter Passing Assume that you don't know what particular parameter passing style a programming lan- guage is using. In order to find out,

 Problem 4- Parameter Passing Assume that you don't know what particular

Problem 4- Parameter Passing Assume that you don't know what particular parameter passing style a programming lan- guage is using. In order to find out, you are asked to write a short test program that will print a different output depending on 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) x integer; procedure bar (integer a) // statement body of foo // statement body of main call bar(x); print x; The body of procedure bar must only contain assignment statements. For instance, you are not allowed to add any new variable declarations. 1. Write the body of procedure bar such that print x in the main progra will print different values for the different parameter passing styles. 2. 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!