C# program to demonstrate the example of Pass by reference parameter passing in a method
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
Program:
The source code to demonstrate Pass by reference parameter passing is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.
Output:
Explanation:
In the above program, we created a Sample class that contains two static methods Swap() and Main() method.
The Swap() method will interchange the values of parameters with each other, and in the Main() method, we created two local variables X and Y. Then swap the values using the Swap() method and print the swapped value on the console screen.