Question: Programming Language Problem set 5 and 7 1)Pass by value 2)Pass by reference 3)Pass by value-result Draw a table for your results You should have
S. Consider the following program written in C syntax: void swap (int a,int b int temp tempai b tep void main) int value 2, list [5(1, 3, 5, 7, 9]h swap (value, list o]) swap (list to, list [1]) swap (value, list [value]) For each of the following parameter-passing methods, what are all of the values of the variables value and list after each of the three calls to swap? a. Passed by value b. Passed by reference c. Passed by value-result 6. Present one argument against providing both static and dynamic local variables in subprograms 7. Consider the following program written in C syntax void fun (int first, int second) first first Programming Exercises 439 second +second; void mainO int list [2, 3) fun (1ist [o, 1ist [11) For each of the following parameter-passing methods, what are the val- ues of the 1ist array after execution? a. Passed by value b. Passed by reference c. Passed by value-result 8. Argue against the C design of providing only function subprograms 9. From a textbook on Fortran, learn the syntax and semantics of statement functions. Justify their existence in Fortran. Study the methods of user-defined operator overloading in C++ and Ada, and write a report comparing the two using our criteria for evaluating languages 10
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
