How do you find the values of x and y?

void refVarFunc(int1 &Num1, int num2)
{
for (int1=0;i<5;i++)
{
num1++;
num2 +=2;
}
}

----------------------------------------

int x = 10, y =2;
refVarFunc(x,y);

return 0;
}
-----------------------------------------


The values are x=15 and y =2

The thing is I don't where these values came from.

Where did x get the 15 from and shouldn't y be 4 since it adds by 2?
What is on the first line of the code that you did post?
void refVarFunc(int &Num1, int num2)
closed account (48T7M4Gy)
x = 15 (in main) because x = 10 is passed by reference, and then it is incremented by 1 by 5 times.

y = 2 (in main) because y is passed by value and not passed by reference
I get it now. Thanks so much!
Topic archived. No new replies allowed.