You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
475 B
C#

4 years ago
/*
* C# Program to Demonstrate Pass by Reference Parameter
*/
using System;
class Program
{
static void Main(string[] args)
{
int val;
val = 4;
Console.WriteLine("Value Before : {0}", val);
square(ref val);
Console.WriteLine("Value After : {0}", val);
Console.Read();
}
static void square(ref int refParam)
{
refParam *= refParam;
}
}
/*
Value Before : 4
Value After : 16