Ask Question
23 July, 22:19

Suppose that you have the following function. void mystery (int& one, int two) { int temp temp = one; one = two; two = temp; } What are the values of x and y after the following statements? (Assume that variables are properly declared.) x = 10; y = 15; mystery (x, y);

+5
Answers (1)
  1. 23 July, 22:48
    0
    x = 15 and y = 10

    Step-by-step explanation:

    It is assumed that 'x' and 'y' are declared as '10' and '15' respectively. Then following the mystery (x, y) function which is pass 10 and 15 as parameter. Then we can follow the logic of the mystery function.

    First, temp is assigned to one; that is temp = 10

    Secondly, one is assigned to two; that is one = 15

    Thirdly, two is assigned to temp; that is two = 10.

    Since x and y is same as one and two; we say:

    x = one = 15 and

    y = two = 10.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Suppose that you have the following function. void mystery (int& one, int two) { int temp temp = one; one = two; two = temp; } What are the ...” in 📙 Mathematics if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers