Intermediate C#
Q48 / 100

What is the difference between ref and out parameters?

Correct! Well done.

Incorrect.

The correct answer is B) ref passes by reference and requires initialization before passing; out passes by reference and must be assigned in the method

B

Correct Answer

ref passes by reference and requires initialization before passing; out passes by reference and must be assigned in the method

Explanation

ref int x requires x to be assigned before the call. out int y does not (the method must assign it). int.TryParse uses out.

Progress
48/100