Menu

[solved]-Consider Following Program Written C Syntax Void Swap Int Int B Int Temp Temp B B Temp Voi Q39079478

Consider the following program written in C syntax:

void swap(int a,int b) {

int temp;

temp = a;

a = b;

b = temp;

}

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]);

}

For each of the following parameter-passing methods, what areall of the

values of the variables value and list after each of the threecalls to

swap?

  1. Passed by value
  2. Passed by reference
  3. Passed by value-result

Expert Answer


Answer to Consider the following program written in C syntax: void swap(int a, int b) { int temp; temp = a; a = b; b = temp; } voi… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *