Ask Question
25 May, 08:00

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

+4
Answers (1)
  1. 25 May, 08:28
    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 you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers