Question: Write the values stored in the value and list [ ] after two swap calls have been made for each parameter transfer method. Write

Write the values stored in the value and list[] after two swap calls have been made for each parameter transfer method. Write "X" for the element if the result is unknown. (However, in Pass by Results and Pass by Value-Result, the evaluation of the real parameter is assumed to occur during the call.)
void main(){
int value =2, list[5]={1,3,5,7,9};
swap(list[0], list[1]);
swap(value, list[value]);
}
void swap(int a, int b){
int temp;
temp = a; a = b; b = temp;
}
(1) Pass by Value [2]
(2) Pass by Result [2]
(3) Pass by Value-Result [2]
(4) Pass by Reference [2]
(5) Pass by Name [2]

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