Question: 5. [5] For the following code please provide the values of the variables value and list using the following parameter passing methods. void swap
5. [5] For the following code please provide the values of the variables value and list using the following parameter passing methods. void swap (int a, int b) { int temp; temp = a; a = b; b = temp; a) Pass-by-Value b) Pass-by Reference c) Pass-by-Value-Result } void main() { int value = 2, list [5] = {1, 3, 5, 7, 9}; swap (value, list [0]); swap (list [0], list[1]); swap(value, list [value]); }
Step by Step Solution
3.35 Rating (158 Votes )
There are 3 Steps involved in it
Ans a PassbyValue In this case there is no change in the values of variables Hence the variable valu... View full answer
Get step-by-step solutions from verified subject matter experts
