Ask Question
16 May, 14:36

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

+2
Answers (1)
  1. 16 May, 14:44
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers