Question: 6. (a) (6%) You are given the following code. void foo (int w, int x, int y, int z) { } W = 11;
6. (a) (6%) You are given the following code. void foo (int w, int x, int y, int z) { } W = 11; x = 12; y = 13; z = Z * 2 ; int main() { int a = 1, b = 2, c = 3; foo (a, b, b, 2 * c); Suppose formal parameters w, x, y, and z are passed by value, by result, by value- result, and by reference respectively. There exists some problem(s) in the above code regarding parameter passing. Identify and describe all of them. (b) (5%) Give a concrete scenerio of writing a subprogram in which static local variables should be used. Your answer should describe the semantics of your subprogram and provide justification of the need to use static local variables. Your answer should not be related to time and space efficiency.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
