using System;
namespace Methods3
{
class Program
{
static void Main()
{
int x = 5, y = 6;
Console.WriteLine("Value of x is {0} and y is {1}", x, y);
exchange(ref x,ref y);
Console.WriteLine("Value of x is {0} and y is {1}", x, y);
Console.ReadKey();
}
static void exchange(ref int a, ref int b)
{
int temp;
temp = a;
a = b;
b = temp;
}
}
}
namespace Methods3
{
class Program
{
static void Main()
{
int x = 5, y = 6;
Console.WriteLine("Value of x is {0} and y is {1}", x, y);
exchange(ref x,ref y);
Console.WriteLine("Value of x is {0} and y is {1}", x, y);
Console.ReadKey();
}
static void exchange(ref int a, ref int b)
{
int temp;
temp = a;
a = b;
b = temp;
}
}
}
Comments
Post a Comment