As title, just after return statement?
int x = 1;
function F(ref int y) { y = y + AnotherF(x); }
function AnotherF(result z)
{
z = null;
return (-1);
}
F(x); print(x); // prints 0 or null?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Answer to myself: The function AnotherF returns -1. The just before destroying its record (and thus before passing the control back to F), the value of z is assigned back to the actual parameter (y). After assigning null to x then F continues to evaluate y = 1 + (-1) = 0. Then x is 0.